示例#1
0
 public PriceAndCostRepository(GridRepository gridRepository)
 {
     wallHandler             = new WallHandler(gridRepository);
     windowHandler           = new WindowHandler(gridRepository);
     wallBeamHandler         = new WallBeamHandler(gridRepository);
     doorHandler             = new DoorHandler(gridRepository);
     decorativeColumnHandler = new DecorativeColumnHandler(gridRepository);
     this._context           = new DatabaseContext();
 }
    private void checkPuzzleSolved(RaycastHit hit, Color compareColor)
    {
        doorHandlerColor  = hit.transform.gameObject.GetComponent <Renderer>().material.color;
        doorHandlerScript = hit.transform.gameObject.GetComponent <DoorHandler>();

        if (doorHandlerColor == compareColor)
        {
            doorHandlerScript.activateAnimation = true;
        }
    }
示例#3
0
        public static void StartTheServer()
        {
            try
            {
                Console.ForegroundColor = ConsoleColor.Green;
                zoneServer.Monsters     = new List <NonPlayerCharacterClass>();
                zoneServer.Vendors      = new List <VendingMachine>();
                zoneServer.Doors        = new List <Doors>();

                using (SqlWrapper sqltester = new SqlWrapper())
                {
                    if (sqltester.SQLCheck() != SqlWrapper.DBCheckCodes.DBC_ok)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine("Database setup not correct");
                        Console.WriteLine("Error: #" + sqltester.lasterrorcode + " - " + sqltester.lasterrormessage);
                        Console.WriteLine("Please press Enter to exit.");
                        Console.ReadLine();
                        Process.GetCurrentProcess().Kill();
                    }
                    sqltester.CheckDBs();
                }

                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("Loaded {0} items", ItemHandler.CacheAllItems());
                Console.WriteLine("Loaded {0} nanos", NanoHandler.CacheAllNanos());
                Console.WriteLine("Loaded {0} spawns", NonPlayerCharacterHandler.CacheAllFromDB());
                Console.WriteLine("Loaded {0} vendors", VendorHandler.CacheAllFromDB());
                Console.WriteLine("Loaded {0} teleports", DoorHandler.CacheAllFromDB());
                Console.WriteLine("Loaded {0} statels", Statels.CacheAllStatels());

                LootHandler.CacheAllFromDB();
                Tradeskill.CacheItemNames();

                csc.AddScriptMembers();
                csc.CallMethod("Init", null);

                ThreadMgr.Start();
                zoneServer.Start();
                Console.ResetColor();
            }
            catch (MySqlException e)
            {
                Console.WriteLine("MySql Error. Server Cannot Start");
                Console.WriteLine("Exception: " + e.Message);
                string       current = DateTime.Now.ToString("HH:mm:ss");
                StreamWriter logfile = File.AppendText("ZoneEngineLog.txt");
                logfile.WriteLine(current + " " + e.Source + " MySql Error. Server Cannot Start");
                logfile.WriteLine(current + " " + e.Source + " Exception: " + e.Message);
                logfile.Close();
                zoneServer.Stop();
                ThreadMgr.Stop();
                Process.GetCurrentProcess().Kill();
            }
        }
示例#4
0
 public void DrawDoors(Graphics graphic)
 {
     if (DOOR_HANDLER == null)
     {
         this.DOOR_HANDLER = new DoorHandler(gridRepository);
     }
     foreach (Door door in DOOR_HANDLER.GetList(this))
     {
         Door doorToDraw = DOOR_HANDLER.GetDoor(door);
         doorToDraw.Draw(graphic);
     }
 }
示例#5
0
        public Grid(string gridName, Client client, int height, int width)
        {
            this.isDeleted         = false;
            this.gridRepository    = new GridRepository();
            this.Walls             = new List <Wall>();
            this.WallBeams         = new List <WallBeam>();
            this.DecorativeColumns = new List <DecorativeColumn>();
            this.Windows           = new List <Window>();
            this.Doors             = new List <Door>();

            this.GridName = gridName;
            this.Client   = client;
            this.Height   = height * PixelConvertor;
            this.Width    = width * PixelConvertor;
            this.PRICE_AND_COST_HANDLER   = new PriceAndCostHandler(gridRepository);
            this.GRID_HANDLER             = new GridHandler();
            this.WALLBEAM_HANDLER         = new WallBeamHandler(gridRepository);
            this.WALL_HANDLER             = new WallHandler(gridRepository);
            this.WINDOW_HANDLER           = new WindowHandler(gridRepository);
            this.DECORATIVECOLUMN_HANDLER = new DecorativeColumnHandler(gridRepository);
            this.DOOR_HANDLER             = new DoorHandler(gridRepository);
        }
示例#6
0
    IEnumerator StartTransition(GameObject warpTile)
    {
        /* Screen Fade Out */
        yield return(StartCoroutine(transition.PlayTransition(Effect.fadeOut, 2f)));

        /* Get Warp Area */
        Transform tmpT = warpTile.transform.parent;

        while (tmpT.tag != "Area")
        {
            tmpT = tmpT.parent;
        }
        AreaHandler warpArea = tmpT.GetComponent <AreaHandler>();

        /* Deactive Old Area */
        activeArea.SetState(false);

        /* Activate New Area */
        warpArea.SetState(true);

        /* Update Active Area */
        activeArea = warpArea;

        /* Play New Song */
        StartCoroutine(sound.PlayMusic(activeArea.music));

        /* If Tile is A Door */
        if (warpTile.tag == "Door")
        {
            /* Transport Player */
            player.transform.position = new Vector2(warpTile.transform.position.x, warpTile.transform.position.y + 0.04f);

            /* Screen Fade In */
            yield return(StartCoroutine(transition.PlayTransition(Effect.fadeIn, 2f)));

            /* Exit Door */
            yield return(StartCoroutine(warpTile.GetComponent <DoorHandler>().ExitDoor()));
        }

        /* If Tile is Stairs */
        else if (warpTile.tag == "Stairs")
        {
            /* Transport Player */
            player.transform.position = warpTile.transform.position;

            /* Get DoorHandler Component */
            DoorHandler door = warpTile.GetComponent <DoorHandler>();

            /* Screen Fade In */
            yield return(StartCoroutine(transition.PlayTransition(Effect.fadeIn, 2f)));

            /* Exit Stairs */
            yield return(StartCoroutine(warpTile.GetComponent <StairsHandler>().ExitStairs()));
        }

        /* Else (Tile is NOT a Door), Just Trasnport and Screen Fade In */
        else
        {
            player.transform.position = new Vector2(warpTile.transform.position.x, warpTile.transform.position.y + 0.08f);
            yield return(StartCoroutine(transition.PlayTransition(Effect.fadeIn, 2f)));
        }

        /* Return Controller To Player */
        player.isControllable = true;
    }
示例#7
0
        /// <summary>
        /// TODO: Add a Description of what this Class does.. -Looks at someone else-
        /// </summary>
        /// <param name="packet"></param>
        /// <param name="client"></param>
        public static void Read(byte[] packet, Client client)
        {
            PacketWriter packetWriter = new PacketWriter();
            PacketReader packetReader = new PacketReader(packet);

            Header header = packetReader.PopHeader();

            packetReader.PopByte();
            byte       moveType    = packetReader.PopByte();
            Quaternion heading     = packetReader.PopQuat();
            AOCoord    coordinates = packetReader.PopCoord();
            // TODO: Find out what these (tmpInt) are and name them
            int tmpInt1 = packetReader.PopInt();
            int tmpInt2 = packetReader.PopInt();
            int tmpInt3 = packetReader.PopInt();

            packetReader.Finish();

            if (!client.Character.DoNotDoTimers)
            {
                WallCollision.LineSegment teleportPlayfield = WallCollision.WallCollisionCheck(
                    coordinates.x, coordinates.z, client.Character.PlayField);
                if (teleportPlayfield.ZoneToPlayfield >= 1)
                {
                    Quaternion   newHeading;
                    CoordHeading coordHeading = WallCollision.GetCoord(teleportPlayfield, coordinates.x, coordinates.z, coordinates);
                    if (teleportPlayfield.Flags != 1337 && client.Character.PlayField != 152 ||
                        Math.Abs(client.Character.Coordinates.y - teleportPlayfield.Y) <= 2
                        ||
                        teleportPlayfield.Flags == 1337 &&
                        Math.Abs(client.Character.Coordinates.y - teleportPlayfield.Y) <= 6)
                    {
                        client.Teleport(coordHeading.Coordinates, coordHeading.Heading, teleportPlayfield.ZoneToPlayfield);
                        Program.zoneServer.Clients.Remove(client);
                    }
                    return;
                }

                if (client.Character.Stats.LastConcretePlayfieldInstance.Value != 0)
                {
                    Doors correspondingDoor = DoorHandler.DoorinRange(
                        client.Character.PlayField, client.Character.Coordinates, 1.0f);
                    if (correspondingDoor != null)
                    {
                        correspondingDoor = DoorHandler.FindCorrespondingDoor(correspondingDoor, client.Character);
                        client.Character.Stats.LastConcretePlayfieldInstance.Value = 0;
                        AOCoord aoc = correspondingDoor.Coordinates;
                        aoc.x += correspondingDoor.hX * 3;
                        aoc.y += correspondingDoor.hY * 3;
                        aoc.z += correspondingDoor.hZ * 3;
                        client.Teleport(aoc, client.Character.Heading, correspondingDoor.playfield);
                        Program.zoneServer.Clients.Remove(client);
                        return;
                    }
                }
            }

            client.Character.RawCoord   = coordinates;
            client.Character.RawHeading = heading;
            client.Character.UpdateMoveType(moveType);

            /* Start NV Heading Testing Code
             * Yaw: 0 to 360 Degrees (North turning clockwise to a complete revolution)
             * Roll: Not sure, but is always 0 cause we can't roll in AO
             * Pitch: 90 to -90 Degrees (90 is nose in the air, 0 is level, -90 is nose to the ground)
             */
            /* Comment this line with a '//' to enable heading testing
             * client.SendChatText("Raw Headings: X: " + client.Character.heading.x + " Y: " + client.Character.heading.y + " Z:" + client.Character.heading.z);
             *
             * client.SendChatText("Yaw:  " + Math.Round(180 * client.Character.heading.yaw / Math.PI) + " Degrees");
             * client.SendChatText("Roll: " + Math.Round(180 * client.Character.heading.roll / Math.PI) + " Degrees");
             * client.SendChatText("Pitch:   " + Math.Round(180 * client.Character.heading.pitch / Math.PI) + " Degrees");
             * /* End NV Heading testing code */

            /* start of packet */
            packetWriter.PushByte(0xDF);
            packetWriter.PushByte(0xDF);
            /* packet type */
            packetWriter.PushShort(10);
            /* unknown */
            packetWriter.PushShort(1);
            /* packet length (writer takes care of this) */
            packetWriter.PushShort(0);
            /* server ID */
            packetWriter.PushInt(3086);
            /* receiver (Announce takes care of this) */
            packetWriter.PushInt(0);
            /* packet ID */
            packetWriter.PushInt(0x54111123);
            /* affected dynel identity */
            packetWriter.PushIdentity(50000, client.Character.Id);
            /* ? */
            packetWriter.PushByte(0);
            /* movement type */
            packetWriter.PushByte(moveType);
            /* Heading */
            packetWriter.PushQuat(heading);
            /* Coordinates */
            packetWriter.PushCoord(coordinates);
            // see reading part for comment
            packetWriter.PushInt(tmpInt1);
            packetWriter.PushInt(tmpInt2);
            packetWriter.PushInt(tmpInt3);
            byte[] reply = packetWriter.Finish();
            Announce.Playfield(client.Character.PlayField, reply);

            if (Statels.StatelppfonEnter.ContainsKey(client.Character.PlayField))
            {
                foreach (Statels.Statel s in Statels.StatelppfonEnter[client.Character.PlayField])
                {
                    if (s.onEnter(client))
                    {
                        return;
                    }
                    if (s.onTargetinVicinity(client))
                    {
                        return;
                    }
                }
            }
        }
 public void setDoorName(string doorName, IMyGridTerminalSystem gts)
 {
     DoorName = doorName;
     // create a doorHandler object.
     doorHandler = new DoorHandler(DoorName, gts);
 }