Exemple #1
0
        public bool OnInitGame(GameClient client)
        {
            KuaFuServerLoginData kuaFuServerLoginData = Global.GetClientKuaFuServerLoginData(client);

            //在跨服主线地图中,这个值表示存储编号
            client.ClientData.MapCode = (int)kuaFuServerLoginData.GameId;
            client.ClientData.PosX    = 0;
            client.ClientData.PosY    = 0;

            List <int> enterFlags = Global.GetRoleParamsIntListFromDB(client, RoleParamName.EnterKuaFuMapFlag);

            if (enterFlags != null && enterFlags.Count >= (int)EKuaFuMapEnterFlag.Max)
            {
                int fromMapCode  = enterFlags[(int)EKuaFuMapEnterFlag.FromMapCode];
                int fromTeleport = enterFlags[(int)EKuaFuMapEnterFlag.FromTeleport];
                int targetBossId = enterFlags[(int)EKuaFuMapEnterFlag.TargetBossId];

                if (fromMapCode > 0 && fromTeleport > 0)
                {
                    // 要通过传送点进入跨服主线,必须检测是否能真正使用这个传送点
                    GameMap     fromGameMap = null;
                    MapTeleport mapTeleport = null;
                    if (GameManager.MapMgr.DictMaps.TryGetValue(fromMapCode, out fromGameMap) &&
                        fromGameMap.MapTeleportDict.TryGetValue(fromTeleport, out mapTeleport))
                    {
                        GameMap toGameMap = null;
                        if (GameManager.MapMgr.DictMaps.TryGetValue(mapTeleport.ToMapID, out toGameMap) &&
                            toGameMap.CanMove(mapTeleport.ToX / toGameMap.MapGridWidth, mapTeleport.ToY / toGameMap.MapGridHeight))
                        {
                            client.ClientData.MapCode = mapTeleport.ToMapID;
                            client.ClientData.PosX    = mapTeleport.ToX;
                            client.ClientData.PosY    = mapTeleport.ToY;
                        }
                    }
                }

                if (targetBossId > 0)
                {
                    Global.ProcessVipLevelUp(client);
                    if (Global.IsVip(client) &&
                        client.ClientData.VipLevel >= GameManager.systemParamsList.GetParamValueIntByName("VIPBossChuanSong", 4))
                    {
                        int bossX, bossY, radis;
                        if (GameManager.MonsterZoneMgr.GetMonsterBirthPoint(client.ClientData.MapCode, targetBossId, out bossX, out bossY, out radis))
                        {
                            radis = 1;
                            Point newPos = Global.GetMapPoint(ObjectTypes.OT_CLIENT, client.ClientData.MapCode, bossX, bossY, radis);
                            client.ClientData.PosX = (int)newPos.X;
                            client.ClientData.PosY = (int)newPos.Y;
                        }
                    }
                }
            }

            return(true);
        }