public TextBox(int id, String text, String font, Vec2i position, Texture parent, ColorRGBA color, int resetKey, int startKey, int sendKey)
            : base(id, position)
        {
            this.parent = parent;

            //Creation:
            Process process = Process.ThisProcess();

            thisView = zCView.Create(Process.ThisProcess(), 0, 0, 0x2000, 0x2000);
            setFont(font);

            tB = new textBox(thisView, process);
            tB.setText(text);
            tB.resetKey        = resetKey;
            tB.startWritingKey = startKey;
            tB.sendKey         = sendKey;

            tB.vt.PosX    = this.position.X;
            tB.vt.PosY    = this.position.Y;
            tB.SendInput += new EventHandler <EventArgs>(tbSended);


            tB.Inputenabled = false;


            setColor(color);
        }
        public textArea(Process process, zCView view, int height)
        {
            this.process = process;
            this.view    = view;

            fontY = this.view.Font.GetFontY();
            fontY = InputHooked.PixelToVirtualY(process, fontY);

            int lines = height / fontY;

            zString empty = zString.Create(process, "");

            vt = new zCViewText[lines];
            for (int i = 0; i < lines; i++)
            {
                vt[i]       = view.CreateText(0, i * fontY, empty);
                vt[i].Timed = 0;
                vt[i].Timer = -1;
            }
            empty.Dispose();


            Inputenabled = true;
            InputHooked.receivers.Add(this);
        }
Beispiel #3
0
        public void Show()
        {
            if (isShown)
            {
                return;
            }
            if (pView == null)
            {
                pView = zCView.Create(process, 0, 0, sizeX, sizeY);

                zString texStr  = zString.Create(process, texture);
                zString fontStr = zString.Create(process, "Font_Old_20_White_Hi.tga");
                pView.InsertBack(texStr);
                pView.SetFont(fontStr);

                texStr.Dispose();
                fontStr.Dispose();

                pView.PrintTimedCXY(zString.Create(process, text), -1, zColor.Create(process, 255, 255, 255, 255));
                pView.SetPos(posX, posY);
            }


            zCView.GetStartscreen(process).InsertItem(pView, 0);
            InputHooked.receivers.Add(this);
            isShown = true;
        }
        public TextArea(int id, String text, String font, Vec2i position, Vec2i size, Texture parent, ColorRGBA color, int resetKey, int startKey, int sendKey)
            : base(id, position)
        {
            this.parent = parent;
            this.font   = font;
            //Creation:
            Process process = Process.ThisProcess();

            thisView = zCView.Create(Process.ThisProcess(), position.X, position.Y, position.X + size.X, position.Y + size.Y);
            thisView.SetFont(font);

            tA = new textArea(process, thisView, size.Y);
            tA.setText(text);
            tA.resetKey        = resetKey;
            tA.startWritingKey = startKey;
            tA.sendKey         = sendKey;

            tA.SendInput += new EventHandler <EventArgs>(tbSended);


            tA.Inputenabled = false;


            setColor(color);
        }
Beispiel #5
0
 public static void ToTop(Process Process)
 {
     zCView.GetStartscreen(Process).RemoveItem(pView);
     //TODO: Löschen!
     pView.Dispose();
     pView = null;
     pShow = false;
     Show(Process);
 }
        public listBox(Process process, int size, zCView view)
        {
            this.process = process;
            this.view    = view;


            tempSize  = 100;
            SpaceText = zString.Create(process, "");
            SetSize(size);
        }
Beispiel #7
0
        public Text3D(int id, String aWorld, float aMaxDistance, GUC.Types.Vec3f aPosition)
            : base(id, new Types.Vec2i(0, 0))
        {
            Process process = Process.ThisProcess();

            m_Position    = aPosition;
            m_MaxDistance = aMaxDistance;
            m_World       = aWorld;

            m_View = zCView.Create(Process.ThisProcess(), 0, 0, 0x2000, 0x2000);
        }
Beispiel #8
0
        public void Hide()
        {
            if (!isShown)
            {
                return;
            }
            zCView.GetStartscreen(process).RemoveItem(pView);
            pView.Dispose();
            pView = null;

            isShown = false;
            InputHooked.receivers.Remove(this);
        }
Beispiel #9
0
        public static Int32 ViewDraw_DrawChildren(String message)
        {
            try
            {
                Process process = Process.ThisProcess();

                return(0);


                GUC.WorldObjects.Character.Player pl = GUC.WorldObjects.Character.Player.Hero;
                if (pl == null)
                {
                    return(0);
                }

                if (pl.ItemList.Count == 0)
                {
                    return(0);
                }

                if (pl.ItemList[0].Address == 0)
                {
                    return(0);
                }
                if (oCGame.Game(process).World.Address == 0)
                {
                    return(0);
                }

                if (rndrWorld == null)
                {
                    rndrWorld = zCWorld.Create(process);
                    rndrWorld.IsInventoryWorld = true;
                }
                oCItem item = new oCItem(process, pl.ItemList[0].Address);

                zCView zV = zCView.Create(Process.ThisProcess(), 0, 0, 0x2000, 0x2000);
                zV.FillZ = true;
                zV.Blit();

                zCView.GetScreen(Process.ThisProcess()).InsertItem(zV, 0);
                item.RenderItem(rndrWorld, zV, 0.0f);
                zCView.GetScreen(Process.ThisProcess()).RemoveItem(zV);
                zV.Dispose();
            }
            catch (Exception ex)
            {
                zERROR.GetZErr(Process.ThisProcess()).Report(4, 'G', ex.ToString(), 0, "ViewDraw_DrawChildren", 0);
            }
            return(0);
        }
Beispiel #10
0
        public textBox(zCView view, Process process)
        {
            this.process = process;
            this.view    = view;
            zString empty = zString.Create(process, "");

            vt = view.CreateText(0, 0, empty);
            empty.Dispose();
            vt.Timed = 0;
            vt.Timer = -1;


            Inputenabled = true;
            InputHooked.receivers.Add(this);
        }
Beispiel #11
0
 protected GUCVisual(int x, int y, int w, int h, bool virtuals, GUCVisual p)
 {
     parent = p;
     if (virtuals)
     {
         vpos  = new ViewPoint(x, y);
         vsize = new ViewPoint(w, h);
     }
     else
     {
         vpos  = PixelToVirtual(x, y);
         vsize = PixelToVirtual(w, h);
     }
     thisView = zCView.Create(vpos.X, vpos.Y, vpos.X + vsize.X, vpos.Y + vsize.Y);
     shown    = false;
 }
        public MessageBox(int id, int lines, String font, Vec2i pos, Texture parent)
            : base(id, pos)
        {
            this.parent = parent;

            //Creation:
            Process process = Process.ThisProcess();

            thisView = zCView.Create(Process.ThisProcess(), 0, 0, 0x2000, 0x2000);
            setFont(font);


            emptyString = zString.Create(process, "");

            createTextViews(lines);
        }
Beispiel #13
0
 public static void Show(Process Process)
 {
     if (pShow)
     {
         return;
     }
     pShow = true;
     if (pView == null)
     {
         pView = zCView.Create(Process, 0, 0, 150, 200);
         zString tex = zString.Create(Process, "Cursor.tga");
         pView.InsertBack(tex);
         tex.Dispose();
     }
     zCView.GetStartscreen(Process).InsertItem(pView, 0);
     noHandle = true;
     //new zCInput_Win32(Process, zCInput.GetInput(Process).Address).SetDeviceEnabled(2, 1);
 }
Beispiel #14
0
        public Text(int id, String text, String font, Vec2i position, Texture parent, ColorRGBA color)
            : base(id, position)
        {
            this.text   = text;
            this.parent = parent;

            //Creation:
            Process process = Process.ThisProcess();

            thisView = zCView.Create(Process.ThisProcess(), 0, 0, 0x2000, 0x2000);

            setFont(font);
            createText();



            setColor(color);
        }
        public void Enable()
        {
            mEnabled = true;

            zString tex = zString.Create(process, "MENU_INGAME");

            viewBG = zCView.Create(process, mPosX, mPosY, mPosX + mWidth, mPosY + mHeight);
            viewBG.InsertBack(tex);
            tex.Dispose();

            zCView.GetStartscreen(process).InsertItem(viewBG, 0);



            SetSize(19);

            EnableInput();
            InputHooked.receivers.Add(this);
        }
Beispiel #16
0
        public static void Show(Process process)
        {
            if (loadingView == null)
            {
                loadingView = zCView.Create(process, 0, 0, 0x2000, 0x2000);
                zString tex = zString.Create(process, "loading.tga");
                loadingView.InsertBack(tex);
                tex.Dispose();
            }

            zCView.GetStartscreen(process).InsertItem(loadingView, 0);


            //zCViewProgressBar progressbar = zCViewProgressBar.Create(process, 0x1254, 0x3e8, 0x1e0c, 0x5dc, Gothic.zClasses.zCView.zTviewID.VIEW_ITEM);
            ////oCGame.Game(process).Progressbar = progressbar;
            ////view.InsertItem(progressbar, 0);
            //progressbar.SetRange(0, 100);
            //progressbar.SetPercent(20, zString.Create(process, " Yay !"));
        }
Beispiel #17
0
        public Bar(Process process, int posX, int posY, String frontTex, String backTex)
        {
            Process = process;


            int[] size  = InputHooked.PixelToVirtual(process, new int[] { 180, 20 });
            int[] sizeB = InputHooked.PixelToVirtual(process, new int[] { 180 - 7, 20 - 3 });
            int[] posB  = InputHooked.PixelToVirtual(process, new int[] { 7, 3 });


            backView = zCView.Create(process, posX, posY, size[0], size[1]);
            zString tex = zString.Create(process, backTex);

            backView.InsertBack(tex);
            tex.Dispose();

            frontView = zCView.Create(process, posX + posB[0], posY + posB[1], sizeB[0], sizeB[1]);
            tex       = zString.Create(process, frontTex);
            frontView.InsertBack(tex);
            tex.Dispose();
        }
Beispiel #18
0
        public Texture(int id, String tex, Vec2i position, Vec2i size, Texture parent, GUIEvents evts)
            : base(id, position)
        {
            this.enabledEvents = evts;
            this.parent        = parent;
            this.size.set(size);


            Process process = Process.ThisProcess();

            view = zCView.Create(process, position.X, position.Y, position.X + this.size.X, position.Y + this.size.Y);

            if (tex != null && tex != "")
            {
                zString text = zString.Create(process, tex);
                view.InsertBack(text);
                text.Dispose();
            }

            updateTimer         = new Timer(200);
            updateTimer.OnTick += timerTick;
        }
Beispiel #19
0
        static void OnDrawItems(WinApiNew.RegisterMemory rmem)
        {
            try
            {
                int viewAddr = rmem.ECX;
                if (rndrDict.TryGetValue(viewAddr, out VobRenderArgs args) && args != null && args.render)
                {
                    var    vob  = args.zenTree ?? args.renderVob;
                    zCView view = new zCView(viewAddr);
                    camera.SetRenderTarget(view);

                    vob.SetPositionWorld(args.Offset.X, args.Offset.Y, args.Offset.Z + 100.0f);
                    lightVob.SetPositionWorld(args.Offset.X, args.Offset.Y, args.Offset.Z); // light in your face
                    args.Rotation.SetMatrix(vob.TrafoObjToWorld);
                    vob.LastTimeDrawn = -1;

                    vob.GroundPoly = 0;
                    rndrWorld.AddVob(vob);

                    bool evMan = zCEventManager.DisableEventManagers;
                    zCEventManager.DisableEventManagers = true;

                    zCRenderer.SetAlphaBlendFunc(zCRenderer.AlphaBlendFuncs.None);
                    rndrWorld.Render(camera);

                    zCEventManager.DisableEventManagers = evMan;

                    rndrWorld.RemoveVobSubTree(vob);

                    view.Blit();
                }
            }
            catch (Exception e)
            {
                Logger.LogError("Hook DrawItems: " + e.ToString());
            }
        }
Beispiel #20
0
        public void Update()
        {
            if (client == null)
            {
                return;
            }

            if (connectionView == null)
            {
                Process process = Process.ThisProcess();
                connectionView = zCView.Create(process, 0, 0, 0x2000, 0x2000);
                zString    str = zString.Create(process, "Connection aborted!");
                zCViewText vt  = connectionView.CreateText(0x950, 0x800, str);
                str.Dispose();
                vt.Color.G = 0;
                vt.Color.B = 0;
                vt.Color.R = 255;
                vt.Color.A = 255;

                vt.Timed = 0;
                vt.Timer = -1;
            }

            if (!shown && (client.GetLastPing(client.GetSystemAddressFromIndex(0)) > 1000 || client.GetLastPing(client.GetSystemAddressFromIndex(0)) <= -1))
            {
                zCView.GetStartscreen(Process.ThisProcess()).InsertItem(connectionView, 0);
                shown = true;
            }
            else if (shown && (client.GetLastPing(client.GetSystemAddressFromIndex(0)) < 700 && client.GetLastPing(client.GetSystemAddressFromIndex(0)) > -1))
            {
                zCView.GetStartscreen(Process.ThisProcess()).RemoveItem(connectionView);
                shown = false;
            }

            int    counter = 0;
            Packet packet  = client.Receive();


            while (packet != null)
            {
                WinApi.Kernel.Process.SetWindowText(System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle, "Gothic II - Untold Chapters - " + client.GetLastPing(client.GetSystemAddressFromIndex(0)));

                switch (packet.data[0])
                {
                case (byte)DefaultMessageIDTypes.ID_CONNECTION_REQUEST_ACCEPTED:
                    isConnected    = true;
                    connectionTrys = 0;
                    break;

                case (byte)DefaultMessageIDTypes.ID_CONNECTION_ATTEMPT_FAILED:
                    logError("Connection Failed!");
                    isConnected = false;
                    break;

                case (byte)DefaultMessageIDTypes.ID_ALREADY_CONNECTED:
                    logError("Already Connected!");
                    break;

                case (byte)DefaultMessageIDTypes.ID_CONNECTION_BANNED:
                    logError("Client banned!");
                    break;

                case (byte)DefaultMessageIDTypes.ID_INVALID_PASSWORD:
                    logError("Wrong password");
                    break;

                case (byte)DefaultMessageIDTypes.ID_INCOMPATIBLE_PROTOCOL_VERSION:
                    logError("ID_INCOMPATIBLE_PROTOCOL_VERSION");
                    break;

                case (byte)DefaultMessageIDTypes.ID_NO_FREE_INCOMING_CONNECTIONS:
                    logError("ID_NO_FREE_INCOMING_CONNECTIONS");
                    break;

                case (byte)DefaultMessageIDTypes.ID_DISCONNECTION_NOTIFICATION:
                case (byte)DefaultMessageIDTypes.ID_CONNECTION_LOST:
                    isConnected = false;
                    break;

                case (byte)DefaultMessageIDTypes.ID_USER_PACKET_ENUM:
                    try
                    {
                        receiveBitStream.Reset();
                        receiveBitStream.Write(packet.data, packet.length);
                        receiveBitStream.IgnoreBytes(2);
                        if ((Player.Hero == null || Player.Hero.ID == 0) && packet.data[1] != (byte)NetworkID.ConnectionMessage)
                        {
                            break;
                        }
                        if (messageListener.ContainsKey(packet.data[1]))
                        {
                            messageListener[packet.data[1]].Read(receiveBitStream, packet, this);
                        }
                    }
                    catch (Exception ex) { zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', ex.Message + ex.StackTrace, 0, "Client.cs", 0); }
                    break;
                }

                client.DeallocatePacket(packet);


                counter++;
                if (counter >= 1000)
                {
                    counter = 0;
                    zERROR.GetZErr(Process.ThisProcess()).Report(2, 'G', "1000 Packete hintereinander", 0, "Client.cs", 0);
                }

                packet = client.Receive();
            }
        }
Beispiel #21
0
 public void SetRenderTarget(zCView viewBase)
 {
     Process.THISCALL <NullReturnCall>(Address, 0x54ABD0, viewBase);
 }
Beispiel #22
0
        public virtual void updatePosition(Process process, long now)
        {
            if (m_Rows.Count == 0)
            {
                return;
            }

            if (Player.Hero == null || Player.Hero.Map == null || Player.Hero.Map.Length == 0)
            {
                return;
            }

            now /= 10000;

            if (m_MaxDistance > 0.0)
            {
                float distance  = Player.Hero.Position.getDistance(this.m_Position);
                bool  tempShown = distance <= m_MaxDistance;
                tempShown &= Player.Hero.Map == m_World;

                setTempShown(tempShown);
            }
            else if (Player.Hero.Map != m_World)
            {
                setTempShown(false);
            }
            else
            {
                setTempShown(true);
            }


            if (m_TempShown)
            {
                zCCamera camera = zCCamera.getActiveCamera(process);
                zCView   screen = m_View;// zCView.GetStartscreen(process);// zCView.GetScreen(Process.ThisProcess());
                //zCCamera.getActiveCamera(process)

                int fontY = screen.FontY();

                using (zVec3 gPosition = zVec3.Create(process))
                {
                    gPosition.X = m_Position.X; gPosition.Y = m_Position.Y; gPosition.Z = m_Position.Z;


                    using (zVec3 newPos = camera.CamMatrix * gPosition)
                    {
                        if (newPos.Z > 0.0f)
                        {
                            float x = 0, y = 0;
                            camera.Project(newPos, out x, out y);
                            Text3DRow[] rows = m_Rows.ToArray();
                            for (int i = 0; i < rows.Length; i++)
                            {
                                int fontWidth  = screen.FontSize(rows[i].Text + "\n");
                                int fontHeight = (rows.Length - (i)) * fontY;

                                int x2 = 0, y2 = 0;
                                x2 = screen.anx((int)x) - fontWidth / 2;
                                y2 = screen.any((int)y) - fontHeight;

                                rows[i].GText.PosX = x2;
                                rows[i].GText.PosY = y2;

                                if (rows[i].Time > 0)
                                {
                                    long t = now - rows[i].InsertTime;
                                    if (t > rows[i].Time)
                                    {
                                        removeRow(rows[i]);
                                    }

                                    if (t > rows[i].Time - rows[i].BlendTime)
                                    {
                                        float t2    = t - (rows[i].Time - rows[i].BlendTime);
                                        float alpha = 1.0f - (1.0f / rows[i].BlendTime * t2);
                                        rows[i].GText.Color.A = (byte)(rows[i].Color.A * alpha);
                                    }
                                }
                            }
                        }
                        else
                        {
                            for (int i = 0; i < m_Rows.Count; i++)
                            {
                                m_Rows[i].GText.PosX = 0x2000;
                                m_Rows[i].GText.PosY = 0x2000;
                            }
                        }
                    }
                }
            }
        }