예제 #1
0
        //Moves the actor to the new zone if exists. No packets are sent nor position changed. Merged zone is removed.
        public void DoSeamlessZoneChange(Player player, uint destinationZoneId)
        {
            Area oldZone;

            if (player.zone != null)
            {
                oldZone = player.zone;
                oldZone.RemoveActorFromZone(player);
            }

            //Add player to new zone and update
            Zone newZone = GetZone(destinationZoneId);

            //This server does not contain that zoneId
            if (newZone == null)
            {
                return;
            }

            newZone.AddActorToZone(player);

            player.zone   = newZone;
            player.zoneId = destinationZoneId;

            player.zone2   = null;
            player.zoneId2 = 0;

            player.SendSeamlessZoneInPackets();

            player.SendMessage(0x20, "", "Doing Seamless Zone Change");

            LuaEngine.GetInstance().CallLuaFunction(player, newZone, "onZoneIn", true);
        }
예제 #2
0
        void LoadInBackground()
        {
            try
            {
                LuaEngine.InitInstance();
                GraphicsManager.InitStatic();
                SoundManager.InitStatic();

                DiagManager.Instance.LoadMsg = "Loading Content";
                Data.DataManager.InitInstance();
                Data.DataManager.Instance.InitData();
                Network.NetworkManager.InitInstance();
                Menu.MenuManager.InitInstance();
                GameManager.InitInstance();
                Dungeon.ZoneManager.InitInstance();
                Dungeon.DungeonScene.InitInstance();
                Ground.GroundScene.InitInstance();

                //Dungeon.DungeonEditScene.InitInstance();
                Dev.GroundEditScene.InitInstance();
                //Notify script engine
                LuaEngine.Instance.OnDataLoad();
                LuaEngine.Instance.UpdateExposedInstances();
                GameManager.Instance.Begin();
            }
            catch (Exception ex)
            {
                DiagManager.Instance.LogError(ex);
            }
            backgroundLoaded             = true;
            DiagManager.Instance.LoadMsg = "Press any key to continue";
        }
예제 #3
0
 //===========================================
 //  Setup pure lua functions
 //===========================================
 public override void SetupLuaFunctions(LuaEngine state)
 {
     WaitStartEntityTask = state.RunString("return function(_, ent, fun) return coroutine.yield(TASK:_WaitStartEntityTask(ent, fun)) end").First() as LuaFunction;
     WaitEntityTask      = state.RunString("return function(_, ent) return coroutine.yield(TASK:_WaitEntityTask(ent)) end").First() as LuaFunction;
     JoinCoroutines      = state.RunString("return function(_, ent) return coroutine.yield(TASK:_JoinCoroutines(ent)) end").First() as LuaFunction;
     WaitTask            = state.RunString("return function(_, ent) return coroutine.yield(TASK:_WaitTask(ent)) end").First() as LuaFunction;
 }
 public GroundTabScriptViewModel()
 {
     ScriptItems = new ObservableCollection <ScriptItem>();
     foreach (LuaEngine.EMapCallbacks v in LuaEngine.EnumerateCallbackTypes())
     {
         ScriptItems.Add(new ScriptItem(v, false));
     }
 }
예제 #5
0
 public Coroutine _CharTurnToCharAnimated(GroundChar curch, GroundChar turnto, int framedur)
 {
     if (curch == null || turnto == null)
     {
         return(new Coroutine(LuaEngine._DummyWait()));
     }
     return(new Coroutine(_DoAnimatedTurn(curch, _CountDirectionDifference(curch.CharDir, turnto.CharDir.Reverse()), framedur)));
 }
 private void Update()
 {
     if (Time.time - lastGCTime > GCInterval)
     {
         LuaEngine.Tick();
         lastGCTime = Time.time;
     }
 }
예제 #7
0
        private void LoadLuaScript()
        {
            string luaPath = String.Format(LuaEngine.FILEPATH_DIRECTORS, GetScriptPath());

            directorScript = LuaEngine.LoadScript(luaPath);
            if (directorScript == null)
            {
                Program.Log.Error("Could not find script for director {0}.", GetName());
            }
        }
예제 #8
0
        public void DoCompletionCheck()
        {
            List <LuaParam> returned = LuaEngine.GetInstance().CallLuaFunctionForReturn(owner, this, "isObjectivesComplete", true);

            if (returned != null && returned.Count >= 1 && returned[0].typeID == 3)
            {
                owner.SendDataPacket("attention", Server.GetWorldManager().GetActor(), "", 25225, (object)GetQuestId());
                owner.SendGameMessage(Server.GetWorldManager().GetActor(), 25225, 0x20, (object)GetQuestId());
            }
        }
예제 #9
0
 public void LoadScriptEvents(List <LuaEngine.EZoneCallbacks> scriptEvents)
 {
     ScriptEvents.Clear();
     foreach (LuaEngine.EZoneCallbacks ev in scriptEvents)
     {
         string assetName = "zone_" + this.ID;
         DiagManager.Instance.LogInfo(String.Format("Zone.LoadScriptEvents(): Added event {0} to zone {1}!", ev.ToString(), assetName));
         ScriptEvents[ev] = new ScriptEvent(LuaEngine.MakeZoneScriptCallbackName(assetName, ev));
     }
 }
예제 #10
0
 /// <summary>
 /// Search the current dungeon's lua package for defined floor callbacks functions, and add those that were found.
 /// </summary>
 private void LoadScriptEvents()
 {
     foreach (var ev in LuaEngine.EnumerateDungeonFloorCallbackTypes())
     {
         string cbackn = LuaEngine.MakeDungeonMapScriptCallbackName(AssetName, ev);
         if (LuaEngine.Instance.DoesFunctionExists(cbackn))
         {
             ScriptEvents[ev] = new ScriptEvent(cbackn);
         }
     }
 }
예제 #11
0
        //Moves actor to new zone, and sends packets to spawn at the given coords.
        public void DoZoneChangeContent(Player player, PrivateAreaContent contentArea, float spawnX, float spawnY, float spawnZ, float spawnRotation, ushort spawnType = SetActorPositionPacket.SPAWNTYPE_WARP_DUTY)
        {
            //Content area was null
            if (contentArea == null)
            {
                Program.Log.Debug("Request to change to content area not on this server by: {0}.", player.customDisplayName);
                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);
            }

            contentArea.AddActorToZone(player);

            //Update player actor's properties
            player.zoneId = contentArea.GetParentZone().actorId;

            player.privateArea     = contentArea.GetPrivateAreaName();
            player.privateAreaType = contentArea.GetPrivateAreaType();
            player.zone            = contentArea;
            player.positionX       = spawnX;
            player.positionY       = spawnY;
            player.positionZ       = spawnZ;
            player.rotation        = spawnRotation;

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

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

            player.playerSession.LockUpdates(false);



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