Exemplo n.º 1
0
        public Director CreateGuildleveDirector(uint glid, byte difficulty, Player owner, params object[] args)
        {
            String directorScriptPath = "";

            uint type = Server.GetGuildleveGamedata(glid).plateId;

            if (glid == 10801 || glid == 12401 || glid == 11601)
            {
                directorScriptPath = "Guildleve/PrivateGLBattleTutorial";
            }
            else
            {
                switch (type)
                {
                case 20021:
                    directorScriptPath = "Guildleve/PrivateGLBattleSweepNormal";
                    break;

                case 20022:
                    directorScriptPath = "Guildleve/PrivateGLBattleChaseNormal";
                    break;

                case 20023:
                    directorScriptPath = "Guildleve/PrivateGLBattleOrbNormal";
                    break;

                case 20024:
                    directorScriptPath = "Guildleve/PrivateGLBattleHuntNormal";
                    break;

                case 20025:
                    directorScriptPath = "Guildleve/PrivateGLBattleGatherNormal";
                    break;

                case 20026:
                    directorScriptPath = "Guildleve/PrivateGLBattleRoundNormal";
                    break;

                case 20027:
                    directorScriptPath = "Guildleve/PrivateGLBattleSurviveNormal";
                    break;

                case 20028:
                    directorScriptPath = "Guildleve/PrivateGLBattleDetectNormal";
                    break;
                }
            }

            lock (directorLock)
            {
                GuildleveDirector director = new GuildleveDirector(directorIdCount, this, directorScriptPath, glid, difficulty, owner, args);
                currentDirectors.Add(director.actorId, director);
                directorIdCount++;
                return(director);
            }
        }
Exemplo n.º 2
0
        //Moves actor to new zone, and sends packets to spawn at the given coords.
        public void DoZoneChange(Player player, uint destinationZoneId, string destinationPrivateArea, int destinationPrivateAreaType, byte spawnType, float spawnX, float spawnY, float spawnZ, float spawnRotation)
        {
            //Add player to new zone and update
            Area newArea;

            if (destinationPrivateArea == null)
            {
                newArea = GetZone(destinationZoneId);
            }
            else //Add check for -1 if it is a instance
            {
                newArea = GetZone(destinationZoneId).GetPrivateArea(destinationPrivateArea, (uint)destinationPrivateAreaType);
            }

            //This server does not contain that zoneId
            if (newArea == null)
            {
                Program.Log.Debug("Request to change to zone not on this server by: {0}.", player.customDisplayName);
                RequestWorldServerZoneChange(player, destinationZoneId, spawnType, spawnX, spawnY, spawnZ, spawnRotation);
                return;
            }

            player.playerSession.LockUpdates(true);

            Area oldZone = player.zone;

            //Remove player from currentZone if transfer else it's login
            if (player.zone != null)
            {
                oldZone.RemoveActorFromZone(player);
            }

            newArea.AddActorToZone(player);

            //Update player actor's properties
            player.zoneId = newArea is PrivateArea ? ((PrivateArea)newArea).GetParentZone().actorId : newArea.actorId;

            player.privateArea     = newArea is PrivateArea ? ((PrivateArea)newArea).GetPrivateAreaName() : null;
            player.privateAreaType = newArea is PrivateArea ? ((PrivateArea)newArea).GetPrivateAreaType() : 0;
            player.zone            = newArea;
            player.positionX       = spawnX;
            player.positionY       = spawnY;
            player.positionZ       = spawnZ;
            player.rotation        = spawnRotation;

            //Delete any GL directors
            GuildleveDirector glDirector = player.GetGuildleveDirector();

            if (glDirector != null)
            {
                player.RemoveDirector(glDirector);
            }

            //Delete content if have
            if (player.currentContentGroup != null)
            {
                player.currentContentGroup.RemoveMember(player.actorId);
                player.SetCurrentContentGroup(null);

                if (oldZone is PrivateAreaContent)
                {
                    ((PrivateAreaContent)oldZone).CheckDestroy();
                }
            }

            //Send packets
            player.playerSession.QueuePacket(DeleteAllActorsPacket.BuildPacket(player.actorId));
            player.playerSession.QueuePacket(_0xE2Packet.BuildPacket(player.actorId, 0x2));
            player.SendZoneInPackets(this, spawnType);
            player.playerSession.ClearInstance();
            player.SendInstanceUpdate();

            player.playerSession.LockUpdates(false);

            //Send "You have entered an instance" if it's a Private Area
            if (newArea is PrivateArea)
            {
                player.SendGameMessage(GetActor(), 34108, 0x20);
            }

            LuaEngine.GetInstance().CallLuaFunction(player, newArea, "onZoneIn", true);
        }