コード例 #1
0
        private void ExecuteHandler(ClientSession session)
        {
            ScriptedInstance orgTimespace = session.CurrentMapInstance.ScriptedInstances
                                            .Find(s => X == s.PositionX && Y == s.PositionY);

            if (orgTimespace != null)
            {
                ScriptedInstance timespace = new ScriptedInstance(orgTimespace);
                timespace.LoadGlobals();
                if (StartPress == 1 || RecordPress == 1)
                {
                    session.EnterInstance(timespace);
                }
                else
                {
                    session.SendPacket(timespace.GenerateRbr());
                }
            }
        }
コード例 #2
0
        internal static void EnterInstance(this ClientSession session, ScriptedInstance input)
        {
            if (input != null)
            {
                ScriptedInstance instance = new ScriptedInstance(input);
                instance.LoadGlobals();
                instance.LoadScript(MapInstanceType.TimeSpaceInstance);
                if (instance.FirstMap == null)
                {
                    return;
                }

                if (session.Character.Level < instance.LevelMinimum)
                {
                    session.SendPacket(
                        UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("NOT_REQUIERED_LEVEL"), 0));
                    return;
                }

                foreach (Gift gift in instance.RequiredItems)
                {
                    if (session.Character.Inventory.CountItem(gift.VNum) < gift.Amount)
                    {
                        session.SendPacket(UserInterfaceHelper.GenerateMsg(
                                               string.Format(Language.Instance.GetMessageFromKey("NOT_ENOUGH_REQUIERED_ITEM"),
                                                             ServerManager.GetItem(gift.VNum).Name), 0));
                        return;
                    }

                    session.Character.Inventory.RemoveItemAmount(gift.VNum, gift.Amount);
                }

                session.Character.MapX = instance.PositionX;
                session.Character.MapY = instance.PositionY;
                ServerManager.Instance.TeleportOnRandomPlaceInMap(session, instance.FirstMap.MapInstanceId);
                instance.InstanceBag.CreatorId = session.Character.CharacterId;
                session.SendPackets(instance.GenerateMinimap());
                session.SendPacket(instance.GenerateMainInfo());
                session.SendPacket(instance.FirstMap.InstanceBag.GenerateScore());

                session.Character.Timespace = instance;
            }
        }