Client source code

Forum for alternative clients, mods & discussions on the same.
Myzreal
Posts: 69
Joined: Sun Jul 03, 2011 5:32 pm

Re: Client source code

Post by Myzreal »

check this by APX - might help (?)

viewtopic.php?f=49&t=40122#p531227


This worked, thanks

I've actually managed to build it but it fails on connect stage. Had all problems with missing jars as well, but finally just've used those that were in the lib folder. Now just can't connect to server.


Run it with the following:

Code: Select all

java -jar hafen.jar -U http://game.havenandhearth.com/hres/ game.havenandhearth.com
Paste me to get hacked: http://a/%%30%30
Creadth
Posts: 7
Joined: Mon Jan 07, 2013 7:28 pm

Re: Client source code

Post by Creadth »

Myzreal wrote:Run it with the following:

Code: Select all

java -jar hafen.jar -U http://game.havenandhearth.com/hres/ game.havenandhearth.com

Working like a charm, thanks!
mvgulik
Posts: 4085
Joined: Fri May 21, 2010 2:29 am

Re: Client source code

Post by mvgulik »

(...nm...)
Last edited by mvgulik on Mon Aug 31, 2015 7:45 pm, edited 1 time in total.
Myzreal
Posts: 69
Joined: Sun Jul 03, 2011 5:32 pm

Re: Client source code

Post by Myzreal »

Any way to figure out coordinates having the source files?
Paste me to get hacked: http://a/%%30%30
User avatar
Reeyfer
Posts: 183
Joined: Tue May 11, 2010 10:03 pm

Re: Client source code

Post by Reeyfer »

loftar wrote:I just put the client source code up at <git://sh.seatribe.se/hafen-client>. Please proceed and ruin everything. :)


:(
nekomune
Posts: 4
Joined: Fri Aug 28, 2015 11:07 pm

Re: Client source code

Post by nekomune »

Myzreal wrote:Any way to figure out coordinates having the source files?


No, coordinates have a random offset when your client retrieves them from the server.
User avatar
Paradoxs
Posts: 294
Joined: Tue Aug 25, 2015 7:16 am

Re: Client source code

Post by Paradoxs »

Shouldn't this be stickied?
User avatar
sabinati
Posts: 15527
Joined: Mon Jul 13, 2009 4:25 am
Location: View active topics

Re: Client source code

Post by sabinati »

Paradoxs wrote:Shouldn't this be stickied?


indeed
User avatar
jaguar
Posts: 251
Joined: Sun Jan 16, 2011 11:59 pm

Re: Client source code

Post by jaguar »

Could somebody add how to compile this?
User avatar
Paradoxs
Posts: 294
Joined: Tue Aug 25, 2015 7:16 am

Re: Client source code

Post by Paradoxs »

jaguar wrote:Could somebody add how to compile this?


  1. Fork the respo
  2. Clone the repo onto your system
  3. Modify the Build.xml

    First Time run (downloads hafen.res and builtin.res

    Code: Select all

    <?xml version="1.0" ?>

    <project name="hafen" default="deftgt">
      <target name="build-env">
        <mkdir dir="build" />
        <mkdir dir="build/classes" />
        <available property="has-res-jar" file="build/hafen-res.jar" />
        <available property="has-buildinfo" file="build/classes/buildinfo" />
        <available property="unpacked-lib" file="build/classes-lib" />
      </target>
     
      <target name="buildinfo" depends="build-env" unless="has-buildinfo">
        <exec executable="git" outputproperty="gitrev" failifexecutionfails="false">
          <arg line="rev-parse HEAD" />
        </exec>
        <echo file="build/classes/buildinfo" xml:space="default">
          git-rev = ${gitrev}
        </echo>
      </target>

      <target name="hafen-client" depends="build-env">
        <javac srcdir="src" destdir="build/classes" debug="on"
          source="1.5" target="1.5" includeantruntime="no">
          <classpath>
       <pathelement path="lib/jogl.jar" />
       <pathelement path="lib/gluegen-rt.jar" />
       <pathelement path="lib/jnlp.jar" />
       <pathelement path="lib/jorbis.jar" />
       <pathelement path="lib/jogg.jar" />
       <pathelement path="lib/jglob.jar" />
          </classpath>
          <compilerarg value="-Xlint:unchecked" />
          <compilerarg value="-Xlint:-options" />
          <!-- <compilerarg value="-Xbarda" /> -->
        </javac>
        <copy todir="build/classes">
          <fileset dir="src" excludes="**/*.java" />
        </copy>
        <copy todir="build/classes/haven" file="etc/ressrv.crt" />
        <copy todir="build/classes/haven" file="etc/authsrv.crt" />
        <copy todir="build/classes/haven" file="etc/res-preload" />
        <copy todir="build/classes/haven" file="etc/res-bgload" />
        <copy todir="build/classes/haven" file="etc/icon.png" />
      </target>
     
      <target name="appletview" depends="build-env">
        <copy file="etc/applet.html" todir="build" />
      </target>

      <target name="lib-classes" depends="build-env" unless="unpacked-lib">
        <mkdir dir="build/classes-lib" />
        <unjar src="lib/jogg.jar" dest="build/classes-lib">
          <patternset excludes="META-INF/**" />
        </unjar>
        <unjar src="lib/jorbis.jar" dest="build/classes-lib">
          <patternset excludes="META-INF/**" />
        </unjar>
        <unjar src="lib/jglob.jar" dest="build/classes-lib">
          <patternset excludes="META-INF/**" />
        </unjar>
      </target>

      <target name="jar" depends="hafen-client,buildinfo,lib-classes">
        <jar destfile="build/hafen.jar" update="true">
          <fileset dir="build/classes" />
          <fileset dir="build/classes-lib" />
          <manifest>
       <attribute name="Main-Class" value="haven.MainFrame" />
       <attribute name="Class-Path" value="jogl.jar gluegen-rt.jar builtin-res.jar hafen-res.jar" />
          </manifest>
        </jar>
        <chmod file="build/hafen.jar" perm="a+x" />
      </target>
     
      <target name="res-jar" depends="build-env" unless="has-res-jar">
       
        <get src="http://game.havenandhearth.com/java/hafen-res.jar" dest="lib/hafen-res.jar"
        usetimestamp="true" />

     <get src="http://game.havenandhearth.com/java/builtin-res.jar" dest="lib/builtin-res.jar"
        usetimestamp="true" />
       
        <available property="lib-res-jar" file="lib/hafen-res.jar" />
        <fail unless="lib-res-jar" message="hafen-res.jar not available" />
        <available property="lib-builtin-jar" file="lib/builtin-res.jar" />
        <fail unless="lib-builtin-jar" message="builtin-res.jar not available" />
      </target>
     
      <target name="jars" depends="build-env, jar, res-jar">
        <copy todir="build">
          <fileset dir="lib">
       <include name="jogl.jar" />
       <include name="gluegen-rt.jar" />
       <include name="hafen-res.jar" />
       <include name="builtin-res.jar" />
          </fileset>
        </copy>
      </target>
     
      <target name="deftgt" depends="jars, appletview" />

      <target name="run" depends="jars">
        <java jar="build/hafen.jar" fork="true" />
      </target>
     
      <target name="clean">
        <delete dir="build" />
      </target>
     
      <target name="profile" depends="jars">
        <nbprofiledirect>
        </nbprofiledirect>
          <java fork="true" jar="build/hafen.jar">
            <jvmarg value="${profiler.info.jvmargs.agent}" />
            <sysproperty key="haven.dbtext" value="on" />
            <sysproperty key="haven.defserv" value="sh.seatribe.se" />
            <sysproperty key="haven.resdir" value="/home/fredrik/src/hafen/res" />
          </java>
      </target>
    </project>


    After you have hafen-res and builtin-res change build to this

    Code: Select all

    <?xml version="1.0" ?>

    <project name="hafen" default="deftgt">
      <target name="build-env">
        <mkdir dir="build" />
        <mkdir dir="build/classes" />
        <available property="has-res-jar" file="build/hafen-res.jar" />
        <available property="has-buildinfo" file="build/classes/buildinfo" />
        <available property="unpacked-lib" file="build/classes-lib" />
      </target>
     
      <target name="buildinfo" depends="build-env" unless="has-buildinfo">
        <exec executable="git" outputproperty="gitrev" failifexecutionfails="false">
          <arg line="rev-parse HEAD" />
        </exec>
        <echo file="build/classes/buildinfo" xml:space="default">
          git-rev = ${gitrev}
        </echo>
      </target>

      <target name="hafen-client" depends="build-env">
        <javac srcdir="src" destdir="build/classes" debug="on"
          source="1.5" target="1.5" includeantruntime="no">
          <classpath>
       <pathelement path="lib/jogl.jar" />
       <pathelement path="lib/gluegen-rt.jar" />
       <pathelement path="lib/jnlp.jar" />
       <pathelement path="lib/jorbis.jar" />
       <pathelement path="lib/jogg.jar" />
       <pathelement path="lib/jglob.jar" />
          </classpath>
          <compilerarg value="-Xlint:unchecked" />
          <compilerarg value="-Xlint:-options" />
          <!-- <compilerarg value="-Xbarda" /> -->
        </javac>
        <copy todir="build/classes">
          <fileset dir="src" excludes="**/*.java" />
        </copy>
        <copy todir="build/classes/haven" file="etc/ressrv.crt" />
        <copy todir="build/classes/haven" file="etc/authsrv.crt" />
        <copy todir="build/classes/haven" file="etc/res-preload" />
        <copy todir="build/classes/haven" file="etc/res-bgload" />
        <copy todir="build/classes/haven" file="etc/icon.png" />
      </target>
     
      <target name="appletview" depends="build-env">
        <copy file="etc/applet.html" todir="build" />
      </target>

      <target name="lib-classes" depends="build-env" unless="unpacked-lib">
        <mkdir dir="build/classes-lib" />
        <unjar src="lib/jogg.jar" dest="build/classes-lib">
          <patternset excludes="META-INF/**" />
        </unjar>
        <unjar src="lib/jorbis.jar" dest="build/classes-lib">
          <patternset excludes="META-INF/**" />
        </unjar>
        <unjar src="lib/jglob.jar" dest="build/classes-lib">
          <patternset excludes="META-INF/**" />
        </unjar>
      </target>

      <target name="jar" depends="hafen-client,buildinfo,lib-classes">
        <jar destfile="build/hafen.jar" update="true">
          <fileset dir="build/classes" />
          <fileset dir="build/classes-lib" />
          <manifest>
       <attribute name="Main-Class" value="haven.MainFrame" />
       <attribute name="Class-Path" value="jogl.jar gluegen-rt.jar builtin-res.jar hafen-res.jar" />
          </manifest>
        </jar>
        <chmod file="build/hafen.jar" perm="a+x" />
      </target>
     
      <target name="res-jar" depends="build-env" unless="has-res-jar">
        <!--
        <get src="http://game.havenandhearth.com/java/hafen-res.jar" dest="lib/hafen-res.jar"
        usetimestamp="true" />

     <get src="http://game.havenandhearth.com/java/builtin-res.jar" dest="lib/builtin-res.jar"
        usetimestamp="true" /> -->
       
        <available property="lib-res-jar" file="lib/hafen-res.jar" />
        <fail unless="lib-res-jar" message="hafen-res.jar not available" />
        <available property="lib-builtin-jar" file="lib/builtin-res.jar" />
        <fail unless="lib-builtin-jar" message="builtin-res.jar not available" />
      </target>
     
      <target name="jars" depends="build-env, jar, res-jar">
        <copy todir="build">
          <fileset dir="lib">
       <include name="jogl.jar" />
       <include name="gluegen-rt.jar" />
       <include name="hafen-res.jar" />
       <include name="builtin-res.jar" />
          </fileset>
        </copy>
      </target>
     
      <target name="deftgt" depends="jars, appletview" />

      <target name="run" depends="jars">
        <java jar="build/hafen.jar" fork="true" />
      </target>
     
      <target name="clean">
        <delete dir="build" />
      </target>
     
      <target name="profile" depends="jars">
        <nbprofiledirect>
        </nbprofiledirect>
          <java fork="true" jar="build/hafen.jar">
            <jvmarg value="${profiler.info.jvmargs.agent}" />
            <sysproperty key="haven.dbtext" value="on" />
            <sysproperty key="haven.defserv" value="sh.seatribe.se" />
            <sysproperty key="haven.resdir" value="/home/fredrik/src/hafen/res" />
          </java>
      </target>
    </project>

  4. Open Build in your java program of choice ad run
    Build will then compile the game and put it in a folder called build/ you then run this using a bat or command line by calling java or javaw like any other program, you cannot simply compile the game and run it, we make our changes, use the build script to compile it and then test them by running the game, editing the build file to do different things is common practice. Mine for example builds the game in a folder called releases, adds a run.bat and moves the libs to a lib folder before compiling the .jar and telling the jar the libs are and even zips it up for sending to people there which brings me to the next step
  5. If the libs are not copied over, you need to move the lib you pc uses to the Build directory. or like ambers client copy all libs inside of lib/jogl-natives folder into the build directory
  6. Enjoy the modding

this was just quick how-to I can be more thorough if you need me to

Return to “The Wizards' Tower”