// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   Applet_Sub1.java

package pack5.pack6.pack7;

import java.applet.Applet;
import java.awt.*;
import java.io.*;
import java.net.InetAddress;
import java.net.Socket;
import pack1.Class13;

// Referenced classes of package pack5.pack6.pack7:
//            Frame_Sub1, Class26, Class24

public class Applet_Sub1 extends Applet
    implements Runnable
{

    public void method8()
    {
    }

    public synchronized void method9()
    {
    }

    public synchronized void method10()
    {
    }

    public void method11(int i, int j, String s, boolean flag)
    {
        aBoolean11 = true;
        anInt4 = i;
        anInt5 = j;
        aFrame_Sub1_10 = new Frame_Sub1(this, i, j, s, flag, false);
        anInt16 = 1;
        aThread6 = new Thread(this);
        aThread6.start();
        aThread6.setPriority(1);
    }

    public void method12(Image image)
    {
        anImage3 = image;
    }

    public void method13(int i)
    {
        anInt7 = 1000 / i;
    }

    public void method14()
    {
        for(int i = 0; i < 10; i++)
            aLongArray9[i] = 0L;

    }

    public synchronized boolean keyDown(Event event, int i)
    {
        boolean flag;
        method15(i);
        anInt35 = i;
        anInt36 = i;
        anInt15 = 0;
        if(i == 1006)
            aBoolean24 = true;
        if(i == 1007)
            aBoolean25 = true;
        if(i == 1004)
            aBoolean26 = true;
        if(i == 1005)
            aBoolean27 = true;
        if((char)i == ' ')
            aBoolean28 = true;
        if((char)i == 'n' || (char)i == 'm')
            aBoolean29 = true;
        if((char)i == 'N' || (char)i == 'M')
            aBoolean29 = true;
        if((char)i == '{')
            aBoolean22 = true;
        if((char)i == '}')
            aBoolean23 = true;
        if((char)i == '\u03F0')
            aBoolean37 = !aBoolean37;
        flag = false;
        int j = 0;
        do
        {
            if(j >= aString21.length())
                break;
            if(i == aString21.charAt(j))
            {
                flag = true;
                break;
            }
            j++;
        } while(true);
        if(!flag || aString38.length() >= 20) goto _L2; else goto _L1
_L1:
        new StringBuilder();
        this;
        JVM INSTR dup_x1 ;
        aString38;
        append();
        (char)i;
        append();
        toString();
        aString38;
_L2:
        if(!flag || aString40.length() >= 80) goto _L4; else goto _L3
_L3:
        new StringBuilder();
        this;
        JVM INSTR dup_x1 ;
        aString40;
        append();
        (char)i;
        append();
        toString();
        aString40;
_L4:
        if(i == 8 && aString38.length() > 0)
            aString38 = aString38.substring(0, aString38.length() - 1);
        if(i == 8 && aString40.length() > 0)
            aString40 = aString40.substring(0, aString40.length() - 1);
        if(i == 10 || i == 13)
        {
            aString39 = aString38;
            aString41 = aString40;
        }
        return true;
    }

    public void method15(int i)
    {
    }

    public synchronized boolean keyUp(Event event, int i)
    {
        anInt35 = 0;
        if(i == 1006)
            aBoolean24 = false;
        if(i == 1007)
            aBoolean25 = false;
        if(i == 1004)
            aBoolean26 = false;
        if(i == 1005)
            aBoolean27 = false;
        if((char)i == ' ')
            aBoolean28 = false;
        if((char)i == 'n' || (char)i == 'm')
            aBoolean29 = false;
        if((char)i == 'N' || (char)i == 'M')
            aBoolean29 = false;
        if((char)i == '{')
            aBoolean22 = false;
        if((char)i == '}')
            aBoolean23 = false;
        return true;
    }

    public synchronized boolean mouseMove(Event event, int i, int j)
    {
        anInt31 = i;
        anInt32 = j + anInt14;
        anInt33 = 0;
        anInt15 = 0;
        return true;
    }

    public synchronized boolean mouseUp(Event event, int i, int j)
    {
        anInt31 = i;
        anInt32 = j + anInt14;
        anInt33 = 0;
        return true;
    }

    public synchronized boolean mouseDown(Event event, int i, int j)
    {
        anInt31 = i;
        anInt32 = j + anInt14;
        anInt33 = event.metaDown() ? 2 : 1;
        anInt34 = anInt33;
        anInt15 = 0;
        method16(anInt33, i, j);
        return true;
    }

    public void method16(int i, int j, int k)
    {
    }

    public synchronized boolean mouseDrag(Event event, int i, int j)
    {
        anInt31 = i;
        anInt32 = j + anInt14;
        anInt33 = event.metaDown() ? 2 : 1;
        return true;
    }

    public void init()
    {
        aBoolean11 = true;
        System.out.println(Class13.method344(-21197));
        anInt4 = 512;
        anInt5 = 384;
        anInt16 = 1;
        method25(this);
    }

    public void start()
    {
        if(anInt12 >= 0)
            anInt12 = 0;
    }

    public void stop()
    {
        if(anInt12 >= 0)
            anInt12 = 4000 / anInt7;
    }

    public void destroy()
    {
        method17();
    }

    public void method17()
    {
        System.exit(0);
    }

    public void method18()
    {
        Class26.method455(Class13.method344(-21267), 0, this);
        Class26.method455(Class13.method344(-21262), 1, this);
        Class26.method455(Class13.method344(-21257), 2, this);
        Class26.method455(Class13.method344(-21252), 3, this);
        Class26.method455(Class13.method344(-21247), 4, this);
        Class26.method455(Class13.method344(-21242), 5, this);
        Class26.method455(Class13.method344(-21237), 6, this);
        Class26.method455(Class13.method344(-21232), 7, this);
    }

    public void run()
    {
        if(anInt16 == 1)
        {
            method18();
            anInt16 = 2;
            aGraphics20 = getGraphics();
            method19();
            aGraphics20.setColor(Color.black);
            method20(0, Class13.method344(7779));
            method8();
            anInt16 = 0;
        }
        int i = 0;
        int j = 256;
        int k = 1;
        int l = 0;
        for(int i1 = 0; i1 < 10; i1++)
            aLongArray9[i1] = System.currentTimeMillis();

        while(anInt12 >= 0) 
        {
            if(anInt12 > 0)
            {
                anInt12--;
                if(anInt12 == 0)
                {
                    method17();
                    aThread6 = null;
                    return;
                }
            }
            int j1 = j;
            int k1 = k;
            j = 300;
            k = 1;
            long l1 = System.currentTimeMillis();
            if(aLongArray9[i] == 0L)
            {
                j = j1;
                k = k1;
            } else
            if(l1 > aLongArray9[i])
                j = (int)((long)(2560 * anInt7) / (l1 - aLongArray9[i]));
            if(j < 25)
                j = 25;
            if(j > 256)
            {
                j = 256;
                k = (int)((long)anInt7 - (l1 - aLongArray9[i]) / 10L);
                if(k < anInt30)
                    k = anInt30;
            }
            try
            {
                Thread.sleep(k);
            }
            catch(InterruptedException interruptedexception) { }
            aLongArray9[i] = l1;
            i = (i + 1) % 10;
            if(k > 1)
            {
                for(int i2 = 0; i2 < 10; i2++)
                    if(aLongArray9[i2] != 0L)
                        aLongArray9[i2] += k;

            }
            int j2 = 0;
            do
            {
                if(l >= 256)
                    break;
                method9();
                l += j;
                if(++j2 <= anInt8)
                    continue;
                l = 0;
                anInt13 += 6;
                if(anInt13 > 25)
                {
                    anInt13 = 0;
                    aBoolean37 = true;
                }
                break;
            } while(true);
            anInt13--;
            l &= 0xff;
            method10();
        }
        if(anInt12 == -1)
            method17();
        aThread6 = null;
    }

    public void update(Graphics g)
    {
        paint(g);
    }

    public void paint(Graphics g)
    {
        if(anInt16 == 2 && anImage3 != null)
            method20(anInt18, aString19);
    }

    public void method19()
    {
        aGraphics20.setColor(Color.black);
        while(anImage3.getWidth(null) == -1 || anImage3.getHeight(null) == -1) ;
        aGraphics20.drawImage(anImage3, anInt4 / 2 - anImage3.getWidth(null) / 2, anInt5 / 2 - anImage3.getHeight(null) / 2, this);
        method18();
    }

    public void method20(int i, String s)
    {
        try
        {
            int j = (anInt4 - 281) / 2;
            int k = (anInt5 - 148) / 2;
            aGraphics20.setColor(Color.black);
            while(anImage3.getWidth(null) == -1 || anImage3.getHeight(null) == -1) ;
            aGraphics20.fillRect(0, 0, anInt4, anInt5);
            aGraphics20.drawImage(anImage3, anInt4 / 2 - anImage3.getWidth(null) / 2, anInt5 / 2 - anImage3.getHeight(null) / 2, this);
            j += 2;
            k += 120;
            anInt18 = i;
            aString19 = s;
            aGraphics20.setColor(aColor1);
            aGraphics20.drawRect(j - 2, k - 2, 280, 23);
            aGraphics20.fillRect(j, k, (277 * i) / 100, 20);
            aGraphics20.setColor(Color.black);
            method22(aGraphics20, s, aFont2, j + 138, k + 10);
            if(aString17 != null)
            {
                aGraphics20.setColor(Color.WHITE);
                method22(aGraphics20, aString17, aFont2, j + 138, k - 120);
                return;
            }
        }
        catch(Exception exception) { }
    }

    public void method21(int i, String s)
    {
        try
        {
            int j = (anInt4 - 281) / 2;
            int k = (anInt5 - 148) / 2;
            j += 2;
            k += 120;
            anInt18 = i;
            aString19 = s;
            int l = (277 * i) / 100;
            aGraphics20.setColor(aColor1);
            aGraphics20.fillRect(j, k, l, 20);
            aGraphics20.setColor(Color.black);
            aGraphics20.fillRect(j + l, k, 277 - l, 20);
            aGraphics20.setColor(Color.WHITE);
            method22(aGraphics20, s, aFont2, j + 138, k + 10);
            return;
        }
        catch(Exception exception)
        {
            return;
        }
    }

    public void method22(Graphics g, String s, Font font, int i, int j)
    {
        FontMetrics fontmetrics = ((Component) (aFrame_Sub1_10 != null ? aFrame_Sub1_10 : this)).getFontMetrics(font);
        fontmetrics.stringWidth(s);
        g.setFont(font);
        g.drawString(s, i - fontmetrics.stringWidth(s) / 2, j + fontmetrics.getHeight() / 4);
    }

    public byte[] method23(InputStream inputstream)
    {
        int i = 0;
        int j = 0;
        byte abyte0[] = null;
        try
        {
            DataInputStream datainputstream = new DataInputStream(inputstream);
            byte abyte2[] = new byte[6];
            datainputstream.readFully(abyte2, 0, 6);
            i = ((abyte2[0] & 0xff) << 16) + ((abyte2[1] & 0xff) << 8) + (abyte2[2] & 0xff);
            j = ((abyte2[3] & 0xff) << 16) + ((abyte2[4] & 0xff) << 8) + (abyte2[5] & 0xff);
            int k = 0;
            abyte0 = new byte[j];
            int l;
            for(; k < j; k += l)
            {
                l = j - k;
                if(l > 1000)
                    l = 1000;
                datainputstream.readFully(abyte0, k, l);
            }

            datainputstream.close();
        }
        catch(IOException ioexception)
        {
            ioexception.printStackTrace();
        }
        if(j != i)
        {
            byte abyte1[] = new byte[i];
            Class24.method408(abyte1, i, abyte0, j, 0);
            return abyte1;
        } else
        {
            return abyte0;
        }
    }

    public Graphics getGraphics()
    {
        if(aFrame_Sub1_10 != null)
            return aFrame_Sub1_10.getGraphics();
        else
            return super.getGraphics();
    }

    public Image createImage(int i, int j)
    {
        if(aFrame_Sub1_10 != null)
            return aFrame_Sub1_10.createImage(i, j);
        else
            return super.createImage(i, j);
    }

    public Socket method24(String s, int i)
    {
        Socket socket = new Socket(InetAddress.getByName(s), i);
        socket.setSoTimeout(30000);
        socket.setTcpNoDelay(true);
        return socket;
    }

    public void method25(Runnable runnable)
    {
        Thread thread = new Thread(runnable);
        thread.setDaemon(true);
        thread.start();
    }

    public Applet_Sub1()
    {
        anInt4 = 512;
        anInt5 = 384;
        anInt7 = 20;
        anInt8 = 1000;
        aLongArray9 = new long[10];
        anInt16 = 1;
        aString19 = Class13.method344(-21205);
        aBoolean22 = false;
        aBoolean23 = false;
        aBoolean24 = false;
        aBoolean25 = false;
        aBoolean26 = false;
        aBoolean27 = false;
        aBoolean28 = false;
        aBoolean29 = false;
        anInt30 = 1;
        aBoolean37 = false;
        aString38 = "";
        aString39 = "";
        aString40 = "";
        aString41 = "";
        anInt42 = 0;
    }

    public static Color aColor1 = new Color(144, 192, 64);
    public static Font aFont2 = new Font(Class13.method344(7790), 0, 12);
    public Image anImage3;
    public int anInt4;
    public int anInt5;
    public Thread aThread6;
    public int anInt7;
    public int anInt8;
    public long aLongArray9[];
    public static Frame_Sub1 aFrame_Sub1_10 = null;
    public boolean aBoolean11;
    public int anInt12;
    public int anInt13;
    public int anInt14;
    public int anInt15;
    public int anInt16;
    public String aString17;
    public int anInt18;
    public String aString19;
    public Graphics aGraphics20;
    public static String aString21 = Class13.method344(14164);
    public boolean aBoolean22;
    public boolean aBoolean23;
    public boolean aBoolean24;
    public boolean aBoolean25;
    public boolean aBoolean26;
    public boolean aBoolean27;
    public boolean aBoolean28;
    public boolean aBoolean29;
    public int anInt30;
    public int anInt31;
    public int anInt32;
    public int anInt33;
    public int anInt34;
    public int anInt35;
    public int anInt36;
    public boolean aBoolean37;
    public String aString38;
    public String aString39;
    public String aString40;
    public String aString41;
    public int anInt42;

}
