public static void F_INIT_PLAYER(BaseClient client, PacketIn packet)
        {
            GameClient cclient = (GameClient)client;

            Player Plr = cclient.Plr;

            if (Plr == null)
            {
                return;
            }

            if (!Plr.IsInWorld()) // If the player is not on a map, then we add it to the map
            {
                ushort zoneId   = Plr.Info.Value.ZoneId;
                ushort regionId = (ushort)Plr.Info.Value.RegionId;

                Zone_Info info = ZoneService.GetZone_Info(zoneId);
                if (info?.Type == 0)
                {
                    RegionMgr region = WorldMgr.GetRegion(regionId, true);
                    if (region.AddObject(Plr, zoneId, true))
                    {
                        return;
                    }
                }
                else if (info?.Type == 4 || info?.Type == 5 || info?.Type == 6) // login into a instance
                {
                    if (!WorldMgr.InstanceMgr.ZoneIn(Plr, (byte)info?.Type))    // cant login into the instace port to exit
                    {
                        Instance_Info II;
                        InstanceService._InstanceInfo.TryGetValue(zoneId, out II);
                        Zone_jump ExitJump = ZoneService.GetZoneJump(II.exitzonejup);
                        if (ExitJump == null)
                        {
                            Log.Error("Exit Jump in Instance", " " + zoneId + " missing!");
                        }
                        else
                        {
                            if (ExitJump.Type == 4)
                            {
                                WorldMgr.InstanceMgr.ZoneIn(Plr, 4, ExitJump);
                            }
                            else
                            {
                                Plr.Teleport(ExitJump.ZoneID, ExitJump.WorldX, ExitJump.WorldY, ExitJump.WorldZ, ExitJump.WorldO);
                            }
                        }
                    }
                    return;
                }

                // Warp a player to their bind point if they attempt to load into a scenario map.
                RallyPoint rallyPoint = RallyPointService.GetRallyPoint(Plr.Info.Value.RallyPoint);

                if (rallyPoint != null)
                {
                    Plr.Teleport(rallyPoint.ZoneID, rallyPoint.WorldX, rallyPoint.WorldY, rallyPoint.WorldZ, rallyPoint.WorldO);
                }

                else
                {
                    CharacterInfo cInfo = CharMgr.GetCharacterInfo(Plr.Info.Career);
                    Plr.Teleport(cInfo.ZoneId, (uint)cInfo.WorldX, (uint)cInfo.WorldY, (ushort)cInfo.WorldZ,
                                 (ushort)cInfo.WorldO);
                }
            }
            else
            {
                Plr.Loaded = false;
                Plr.StartInit();
            }
        }
Пример #2
0
        public static void F_INIT_PLAYER(BaseClient client, PacketIn packet)
        {
            GameClient cclient = (GameClient)client;

            Player Plr = cclient.Plr;

            if (Plr == null)
            {
                return;
            }

            // clear all lockouts if they are expired
            InstanceService.ClearLockouts(Plr);

            if (!Plr.IsInWorld()) // If the player is not on a map, then we add it to the map
            {
                ushort zoneId   = Plr.Info.Value.ZoneId;
                ushort regionId = (ushort)Plr.Info.Value.RegionId;

                Zone_Info info = ZoneService.GetZone_Info(zoneId);
                if (info?.Type == 0)
                {
                    RegionMgr region = WorldMgr.GetRegion(regionId, true);
                    if (region.AddObject(Plr, zoneId, true))
                    {
                        return;
                    }
                }
                else if (info?.Type == 4 || info?.Type == 5 || info?.Type == 6)  // login into a instance results in teleport outside
                {
                    if (InstanceService._InstanceInfo.TryGetValue(zoneId, out Instance_Info II))
                    {
                        Zone_jump ExitJump = null;
                        if (Plr.Realm == Realms.REALMS_REALM_ORDER)
                        {
                            ExitJump = ZoneService.GetZoneJump(II.OrderExitZoneJumpID);
                        }
                        else if (Plr.Realm == Realms.REALMS_REALM_DESTRUCTION)
                        {
                            ExitJump = ZoneService.GetZoneJump(II.DestrExitZoneJumpID);
                        }

                        if (ExitJump == null)
                        {
                            Log.Error("Exit Jump in Instance", " " + zoneId + " missing!");
                        }
                        else
                        {
                            Plr.Teleport(ExitJump.ZoneID, ExitJump.WorldX, ExitJump.WorldY, ExitJump.WorldZ, ExitJump.WorldO);
                        }
                    }
                    return;
                }

                // Warp a player to their bind point if they attempt to load into a scenario map.
                RallyPoint rallyPoint = RallyPointService.GetRallyPoint(Plr.Info.Value.RallyPoint);

                if (rallyPoint != null)
                {
                    Plr.Teleport(rallyPoint.ZoneID, rallyPoint.WorldX, rallyPoint.WorldY, rallyPoint.WorldZ, rallyPoint.WorldO);
                }
                else
                {
                    CharacterInfo cInfo = CharMgr.GetCharacterInfo(Plr.Info.Career);
                    Plr.Teleport(cInfo.ZoneId, (uint)cInfo.WorldX, (uint)cInfo.WorldY, (ushort)cInfo.WorldZ,
                                 (ushort)cInfo.WorldO);
                }
            }
            else
            {
                Plr.Loaded = false;
                Plr.StartInit();
            }
        }