Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSRS Integration #473

Open
wants to merge 63 commits into
base: kotlin-experiments
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
0930e66
Cache definitions, update server and most of login done for rev 181.
Feb 29, 2020
910a9c6
Replaced numeric constant '181' with the release revision.
Feb 29, 2020
36ee4c0
Bumped the JDK version in the azure-pipelines.yml to 11 from 1.8.
Feb 29, 2020
1f6041c
Binding on the same port is now filtered out. This occurs when the ne…
Feb 29, 2020
662570e
Login decoding updated to OSRS.
Mar 1, 2020
b901cb5
Documented user stats.
Mar 1, 2020
0cf9710
Updated UserStats to revision 8.
Mar 1, 2020
86cc048
Worldlist is now available. Currently it's just magic constants until…
Mar 1, 2020
72292a2
Worldlist is now available. Currently it's just magic constants until…
Mar 2, 2020
071b04d
Added the following encode messages: Varp
Mar 2, 2020
570745a
Player options decoders.
Mar 3, 2020
a45b4d3
Npc options decoders.
Mar 3, 2020
e0e3bd7
Refractored the directories in which each file lives. This seems more…
Mar 3, 2020
b0c0918
Refractored the directories in which each file lives. This seems more…
Mar 3, 2020
1e133f6
Changes the writeString(...) method's in BufferUtil.java to use Windo…
Mar 4, 2020
b4a3a62
Login to World complete.
Mar 11, 2020
3ef4250
InterfaceSet.java is updated to support osrs functionality.
Mar 15, 2020
4362b4f
Reduces the move-toplevel code.
Mar 15, 2020
db9a443
Experience and Weight Encoder messages.
Mar 15, 2020
ccc7e0f
Added the run-energy message.
Mar 15, 2020
9fcb2fd
Organized imports.
Mar 15, 2020
3ac6b6b
Added the plugins for shops back with proper npc ids.
Mar 15, 2020
7fe0272
Added the plugins for shops back with proper npc ids.
Mar 15, 2020
f972fd1
Fixes spawns with modern names.
Mar 15, 2020
a0d9869
Gets rid of leak from the ondemand response encoder.
Mar 15, 2020
060053e
Added SetPlayerActionMessageEncoder message.
Mar 22, 2020
948fad1
Inventory messages are complete.
Mar 22, 2020
ac27c8e
Item-interface interactions complete.
Mar 24, 2020
ef75cda
Ground items interactions complete.
Mar 25, 2020
62bd614
Moved around some decoder messages.
Mar 25, 2020
48e3fc4
Did a ton of encoder messages for interfaces.
Mar 26, 2020
a9ea8d2
Standard field names.
Mar 26, 2020
0f7a35e
Added logout message and set flag message.
Mar 26, 2020
8d3c198
Added logout message and set flag message.
Mar 26, 2020
677e994
Action support for clicks.
Mar 27, 2020
8a3db74
Moved a ton of messages.
Mar 27, 2020
1cd9a17
GPI nearly complete. Still need masks. Going to clean up the code more.
Apr 5, 2020
0a1ef20
GPI nearly complete. Still need masks. Going to clean up the code more.
Apr 10, 2020
f96ef85
Gpi done.
Apr 12, 2020
d00c6b4
Fixes compiler error on chat (somehow didn't get versioned)
Apr 12, 2020
028663d
Teleport happens post-tick.
Apr 12, 2020
65309ab
Added tutorial island wood and oak tree identifiers.
Apr 12, 2020
15833bf
Fixes title mask flag.
Apr 12, 2020
bbc0e13
Keyboard event added.
Apr 12, 2020
ac00bc2
ChatFilterSettingsMessage added.
Apr 12, 2020
c858ac4
Removed item option, we should have one consistent message for that.
Apr 13, 2020
5037fff
Fixes issue with inventory and component id being swapped.
Apr 13, 2020
88928e9
Removed some debug statements from GPI.
Apr 13, 2020
deb1a17
Zone packets, add and remove object messages.
Apr 13, 2020
c9f5e73
Added proper priorities and the UpdateZonePartialEnclosedEncoder.
Apr 13, 2020
0c92c9f
Finished supported map zone packets.
Apr 14, 2020
a15165b
Added unsupported map zone packets.
Apr 15, 2020
d56d375
Fixes issue with crash when changing regions.
Apr 15, 2020
4cbe700
Adds more packets to queue, previous limit was 25 packets. Osrs can h…
Apr 15, 2020
7b5b158
Adds huffman codec class to properly compress/decompress mesasges.
Apr 20, 2020
4af53e9
Fixes problem that broke pub chat. Still need to fix compression for …
Apr 20, 2020
4bddfe2
Fixes issue with HuffmanCodec
Apr 22, 2020
04ab087
Fixes codec issues.
Apr 22, 2020
79ac1a8
Fixes issue with HuffmanCodec
Apr 22, 2020
ba28a23
Friends list interactions complete.
Apr 22, 2020
e393743
Ignores list complete.
Apr 22, 2020
bfb2619
All the changes that sfix has asked for.
Apr 26, 2020
ba35a57
Code review pass #2 osrs-proposal
May 12, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,7 +1,5 @@
package org.apollo.net.update.resource;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.apollo.util.BufferUtil;

import java.io.IOException;
Expand All @@ -19,25 +17,33 @@ public boolean accept(String path) throws IOException {

@Override
public Optional<ByteBuffer> get(String path) throws IOException {
final var buf = Unpooled.buffer();
final var world = createWorld();
final var buf = ByteBuffer.allocate(Integer.BYTES + world.remaining());

buf.writeInt(world.readableBytes());
buf.writeBytes(world);
buf.putInt(world.remaining());
buf.put(world);

return Optional.of(buf.nioBuffer());
return Optional.of(buf.flip());
}

private ByteBuf createWorld() {
ByteBuf world = Unpooled.buffer();
world.writeShort(1); // number of worlds

world.writeShort(1); // world id
world.writeInt(0); // world settings
BufferUtil.writeString(world, "127.0.0.1"); // address
BufferUtil.writeString(world, "Converting Apollo"); // address
world.writeByte(0); // country
world.writeShort(2000);// number of players
return world;
private ByteBuffer createWorld() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we actually need this to get login working?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Client freezes without it when clicked on by mistake.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, then I'd be inclined to make it return real data. cc @Major-

final var address = "127.0.0.1";//10
final var activity = "Converting Apollo";//18

ByteBuffer world = ByteBuffer.allocate(Short.BYTES + Integer.BYTES + address.length() + activity
.length() + Byte.BYTES + Byte.BYTES + Byte.BYTES + Short.BYTES);
world.putShort((short) 1); // world id
world.putInt(0); // world settings
BufferUtil.writeString(world, address); // address
BufferUtil.writeString(world, activity); // activity
world.put((byte) 0); // country
world.putShort((short) 2000);// number of players
world.flip();

ByteBuffer list = ByteBuffer.allocate(Short.BYTES + world.remaining());
list.putShort((short) 1); // number of worlds
list.put(world);

return list.flip();
}
}
11 changes: 11 additions & 0 deletions util/src/main/java/org/apollo/util/BufferUtil.java
Expand Up @@ -112,6 +112,17 @@ public static void writeString(ByteBuf buffer, String str) {
buffer.writeByte(0);
}

/**
* Writes a string to the specified {@link ByteBuf}
* @param buffer
* @param str
*/
public static void writeString(ByteBuffer buffer, String str) {
byte[] bytes = str.getBytes(StandardCharsets.ISO_8859_1);
buffer.put(bytes);
buffer.put((byte) 0);
}

/**
* The terminator of a string.
*/
Expand Down