RuneHive-Game
Loading...
Searching...
No Matches
InterfaceWriter.java
Go to the documentation of this file.
1package com.runehive.content.writer;
2
3import com.runehive.net.packet.out.SendColor;
4import com.runehive.net.packet.out.SendFont;
5import com.runehive.net.packet.out.SendString;
6import com.runehive.game.world.entity.mob.player.Player;
7
8/**
9 * Handles writing on an itemcontainer.
10 *
11 * @author Daniel
12 *
13 */
14public abstract class InterfaceWriter {
15
17 this.player = player;
18 }
19
20 protected Player player;
21
22 protected abstract int startingIndex();
23
24 protected abstract String[] text();
25
26 protected abstract int[][] color();
27
28 protected abstract int[][] font();
29
30 public void scroll() {
31
32 }
33
34 public static void write(InterfaceWriter writer) {
35 writer.scroll();
36
37 /* Sends the text */
38 int line = writer.startingIndex();
39 if (writer.text() != null) {
40 for (int index = 0; index < writer.text().length; index++) {
41 writer.player.send(new SendString(writer.text()[index], line++));
42 }
43 }
44
45 /* Sends the color */
46 if (writer.color() != null) {
47 for (int index = 0; index < writer.color().length; index++) {
48 writer.player.send(new SendColor(writer.color()[index][0], writer.color()[index][1]));
49 }
50 }
51
52 /* Sends the font */
53 if (writer.font() != null) {
54 for (int index = 0; index < writer.font().length; index++) {
55 writer.player.send(new SendFont(writer.font()[index][0], writer.font()[index][1]));
56 }
57 }
58 }
59
60}
static void write(InterfaceWriter writer)
This class represents a character controlled by a player.
Definition Player.java:125
The OutgoingPacket that sends a color to a string in the client.
The OutgoingPacket that sends a font to a string in the client.
Definition SendFont.java:14
The OutgoingPacket that sends a string to a Players itemcontainer in the client.