Commit 70f49416 authored by Joe's avatar Joe

New client F2 side menu

parent f675a604
package com.openrsc.interfaces.misc;
import com.openrsc.interfaces.InputListener;
import com.openrsc.interfaces.NComponent;
import com.openrsc.interfaces.NCustomComponent;
import com.openrsc.interfaces.misc.party.Party;
import com.openrsc.client.entityhandling.EntityHandler.GUIPARTS;
import com.openrsc.client.entityhandling.EntityHandler;
import orsc.graphics.gui.SocialLists;
import orsc.mudclient;
import orsc.util.GenUtil;
import orsc.Config;
import java.util.Date;
import java.text.SimpleDateFormat;
public class SideMenu {
public static mudclient mc;
public NComponent sideMenuComponent;
public SideMenu(final mudclient graphics) {
sideMenuComponent = new NComponent(graphics);
//sideMenuComponent.setBackground(0xFFFFFF, 0xFFFFFF, 128);
sideMenuComponent.setLocation((graphics.getGameWidth() - 175) / 20, graphics.getGameHeight() - 310);
NCustomComponent sideMenuItself = new NCustomComponent(graphics) {
@Override
public void render() {
float sideMenuWidth = 120;
int i2 = getY() - 6;
int i3 = 0;
int var12;
if (graphics.getF2OppName() == 0) {
if(graphics.getLocalPlayer().inCombat == 1 && graphics.getOppCurHp() != 0){
graphics.getSurface().drawString("@red@" + graphics.getOppName() + "@whi@: " + graphics.getOppCurHp() + "/" + graphics.getOppMaxHp(), getX() - 20, i2, 0xffffff, 0);
i2 += 12;
i3 += 1;
}
}
if (graphics.getF2Hits() == 0) {
int hpMissing = 0;
double prog1 = 0;
double prog2 = 0;
hpMissing = graphics.playerStatBase[3] - graphics.playerStatCurrent[3];
prog1 = ((double) hpMissing / graphics.playerStatBase[3]);
prog2 = (prog1 * 75);
int prog3 = (int) Math.round(prog2);
graphics.getSurface().drawBox(getX() - 20, i2 - 9, 75, 10, 0xFF0000);
graphics.getSurface().drawBox(getX() - 20, i2 - 9, 75 - prog3, 10, 0x00FF00);
graphics.getSurface().drawString(
"Hits: " + graphics.playerStatCurrent[3] + "@gre@/@whi@" + graphics.playerStatBase[3], getX() - 20, i2, 0xffffff, 0);
i2 += 12;
i3 += 1;
}
if (graphics.getF2Prayer() == 0) {
int hpMissing = 0;
double prog1 = 0;
double prog2 = 0;
hpMissing = graphics.playerStatBase[5] - graphics.playerStatCurrent[5];
prog1 = ((double) hpMissing / graphics.playerStatBase[5]);
prog2 = (prog1 * 75);
int prog3 = (int) Math.round(prog2);
graphics.getSurface().drawBox(getX() - 20, i2 - 9, 75, 10, 0x9F9F9F);
graphics.getSurface().drawBox(getX() - 20, i2 - 9, 75 - prog3, 10, 0x00FF00);
graphics.getSurface().drawString(
"Prayer: " + graphics.playerStatCurrent[5] + "@gre@/@whi@" + graphics.playerStatBase[5], getX() - 20, i2, 0xffffff, 0);
i2 += 12;
i3 += 1;
}
if (graphics.getF2Fatigue() == 0) {
int hpMissing = 0;
double prog1 = 0;
double prog2 = 0;
hpMissing = 100 - graphics.getStatFatigue();
prog1 = ((double) hpMissing / 100);
prog2 = (prog1 * 75);
int prog3 = (int) Math.round(prog2);
graphics.getSurface().drawBox(getX() - 20, i2 - 9, 75, 10, 0x9F9F9F);
graphics.getSurface().drawBox(getX() - 20, i2 - 9, 75 - prog3, 10, 0xFF0000);
graphics.getSurface().drawString(
"Fatigue: " + graphics.getStatFatigue() + "%", getX() - 20, i2, 0xffffff, 0);
i2 += 12;
i3 += 1;
}
if (graphics.getOp() == 0) {
graphics.getSurface().drawString(
"Online Players: " + graphics.getOnlinePlayers() + "", getX() - 20, i2, 0xffffff, 0);
i2 += 12;
i3 += 1;
}
if (graphics.getF2KillStreak() == 0) {
graphics.getSurface().drawString(
"Kill Streak: " + graphics.getKillStreak() + "", getX() - 20, i2, 0xffffff, 0);
i2 += 12;
i3 += 1;
}
Date now = new Date();
SimpleDateFormat simpleDateformat = new SimpleDateFormat("MM/dd/yyyy");
if (graphics.getF2Date() == 0) {
graphics.getSurface().drawString(
"@yel@" + simpleDateformat.format(now), getX() - 20, i2, 0xffffff, 0);
i2 += 12;
i3 += 1;
}
if (graphics.getLocalPlayer().isDev()) {
graphics.getSurface().drawString("Tile: @gre@(@whi@" + (graphics.getPlayerLocalX() + graphics.getMidRegionBaseX())
+ "@gre@,@whi@" + (graphics.getPlayerLocalZ() + graphics.getMidRegionBaseZ()) + "@gre@)", getX() - 20, i2, 0xffffff, 0);
i2 += 12;
i3 += 1;
}
sideMenuComponent.setSize(100, i3 * 12 + 4);
}
};
sideMenuItself.setLocation(25, 20);
sideMenuComponent.setBackground(10000536, 10000536, 80);
final NComponent headerComponent = new NComponent(graphics);
int i4 = 0;
if (graphics.getF2OppName() == 0) {
if(graphics.getLocalPlayer().inCombat == 1 && graphics.getOppCurHp() != 0){
i4 += 1;
}
}
if (graphics.getF2Hits() == 0) {
i4 += 1;
}
if (graphics.getF2Prayer() == 0) {
i4 += 1;
}
if (graphics.getF2Fatigue() == 0) {
i4 += 1;
}
if (graphics.getOp() == 0) {
i4 += 1;
}
if (graphics.getF2KillStreak() == 0) {
i4 += 1;
}
if (graphics.getF2Date() == 0) {
i4 += 1;
}
if (graphics.getLocalPlayer().isDev()) {
i4 += 1;
}
headerComponent.setSize(100, 16);
//headerComponent.setBackground(0, 0, 156);
headerComponent.setLocation(0, 0);
headerComponent.setFontColor(0xFFFFFF, 0xFFFFFF);
headerComponent.setTextCentered(true);
headerComponent.setInputListener(new InputListener() {
@Override
public boolean onMouseDown(int clickX, int clickY, int mButtonDown, int mButtonClick) {
if (mButtonDown == 2 && sideMenuComponent.isVisible()) {
int newX = clickX - (headerComponent.getWidth() / 2);
int newY = clickY - 5;
int totalCoverageX = newX + sideMenuComponent.getWidth();
int totalCoverageY = newY + sideMenuComponent.getHeight();
if (totalCoverageX > graphics.getGameWidth()) {
newX -= totalCoverageX - graphics.getGameWidth();
}
if (totalCoverageY > graphics.getGameHeight()) {
newY -= totalCoverageY - graphics.getGameHeight();
}
if (newX < 0)
newX = 0;
if (newX < 0)
newX = 0;
sideMenuComponent.setLocation(newX, newY);
return true;
}
return false;
}
});
sideMenuComponent.addComponent(headerComponent);
sideMenuComponent.addComponent(sideMenuItself);
sideMenuComponent.setVisible(false);
}
public void show() {
sideMenuComponent.setVisible(true);
}
public void hide() {
sideMenuComponent.setVisible(false);
}
public void resetSideMenu() {
sideMenuComponent.setVisible(false);
}
public NComponent getComponent() {
return sideMenuComponent;
}
}
......@@ -132,7 +132,7 @@ public final class mudclient implements Runnable {
private static String[] skillNames;
public static int skillCount;
private final int[] playerSkinColors = new int[]{15523536, 13415270, 11766848, 10056486, 9461792};
private int[] playerStatBase;
public int[] playerStatBase;
private int[] playerExperience;
private boolean experienceOff = false;
public final int[] playerStatEquipment = new int[5];
......@@ -444,9 +444,9 @@ public final class mudclient implements Runnable {
private String newPassword;
private String password = "";
private int playerCount = 0;
private int playerLocalX;
public int playerLocalX;
private int playerLocalZ;
private int[] playerStatCurrent;
public int[] playerStatCurrent;
private String[] messagesArray = new String[5];
private long[] playerStatXpGained;
private long playerPointsGained;
......@@ -588,6 +588,7 @@ public final class mudclient implements Runnable {
private NCustomComponent experienceOverlay;
private ProgressBarInterface batchProgressBar;
private PartyGUI partyMenu;
private SideMenu sideMenu;
private BankPinInterface bankPinInterface;
private FishingTrawlerInterface fishingTrawlerInterface;
public AchievementGUI achievementInterface;
......@@ -5376,117 +5377,28 @@ public final class mudclient implements Runnable {
}
});
}
if (S_SIDE_MENU_TOGGLE && C_SIDE_MENU_OVERLAY) {
int i = 130;
if (f2OppName == 0) {
if(localPlayer.inCombat == 1 && this.oppCurHp != 0){
//this.getSurface().drawString("@whi@" + this.oppCurHp + "/" + this.oppMaxHp, width1 / 7 + var15, y - 10, 0, 0);
this.getSurface().drawString("@red@" + this.oppName + "@whi@: " + this.oppCurHp + "/" + this.oppMaxHp, 7, i, 0xffffff, 0);
}
i += 14;
}
if (f2Hits == 0) {
int hpMissing = 0;
double prog1 = 0;
double prog2 = 0;
hpMissing = this.playerStatBase[3] - this.playerStatCurrent[3];
prog1 = ((double) hpMissing / this.playerStatBase[3]);
prog2 = (prog1 * 75);
int prog3 = (int) Math.round(prog2);
this.getSurface().drawBox(6, i - 9, 75, 10, 0xFF0000);
this.getSurface().drawBox(6, i - 9, 75 - prog3, 10, 0x00FF00);
this.getSurface().drawString(
"Hits: " + this.playerStatCurrent[3] + "@gre@/@whi@" + this.playerStatBase[3], 7, i, 0xffffff, 0);
i += 14;
}
if (f2Prayer == 0) {
int hpMissing = 0;
double prog1 = 0;
double prog2 = 0;
hpMissing = this.playerStatBase[5] - this.playerStatCurrent[5];
prog1 = ((double) hpMissing / this.playerStatBase[5]);
prog2 = (prog1 * 75);
int prog3 = (int) Math.round(prog2);
this.getSurface().drawBox(6, i - 9, 75, 10, 0x9F9F9F);
this.getSurface().drawBox(6, i - 9, 75 - prog3, 10, 0x00FF00);
int i = 130;
if(inTdm != 0) {
if(tdmTeam == 1) {
this.getSurface().drawString(
"Prayer: " + this.playerStatCurrent[5] + "@gre@/@whi@" + this.playerStatBase[5], 7, i, 0xffffff, 0);
"@red@Kills - " + this.tdmKills, 7, i, 0xffffff, 0);
i += 14;
}
if(inTdm == 0) {
if (f2Fatigue == 0) {
int hpMissing = 0;
double prog1 = 0;
double prog2 = 0;
hpMissing = 100 - this.statFatigue;
prog1 = ((double) hpMissing / 100);
prog2 = (prog1 * 75);
int prog3 = (int) Math.round(prog2);
this.getSurface().drawBox(6, i - 9, 75, 10, 0x9F9F9F);
this.getSurface().drawBox(6, i - 9, 75 - prog3, 10, 0xFF0000);
this.getSurface().drawString(
"Fatigue: " + this.statFatigue + "%", 7, i, 0xffffff, 0);
i += 14;
}
if (oP == 0) {
this.getSurface().drawString(
"Online Players: " + this.onlinePlayers + "", 7, i, 0xffffff, 0);
"@red@Deaths - " + this.tdmDeaths, 7, i, 0xffffff, 0);
i += 14;
}
Date now = new Date();
SimpleDateFormat simpleDateformat = new SimpleDateFormat("MM/dd/yyyy");
if (f2KillStreak == 0) {
} else if(tdmTeam == 2) {
this.getSurface().drawString(
"Kill Streak: " + this.killStreak + "", 7, i, 0xffffff, 0);
"@blu@Kills - " + this.tdmKills, 7, i, 0xffffff, 0);
i += 14;
}
if (f2Date == 0) {
this.getSurface().drawString(
"@yel@" + simpleDateformat.format(now), 7, i, 0xffffff, 0);
"@blu@Deaths - " + this.tdmDeaths, 7, i, 0xffffff, 0);
i += 14;
}
} else {
if(tdmTeam == 1) {
this.getSurface().drawString(
"@red@Kills - " + this.tdmKills, 7, i, 0xffffff, 0);
i += 14;
this.getSurface().drawString(
"@red@Deaths - " + this.tdmDeaths, 7, i, 0xffffff, 0);
i += 14;
} else if(tdmTeam == 2) {
this.getSurface().drawString(
"@blu@Kills - " + this.tdmKills, 7, i, 0xffffff, 0);
i += 14;
this.getSurface().drawString(
"@blu@Deaths - " + this.tdmDeaths, 7, i, 0xffffff, 0);
i += 14;
}
}
if (localPlayer.isDev()) {
this.getSurface().drawString("Tile: @gre@(@whi@" + (playerLocalX + midRegionBaseX)
+ "@gre@,@whi@" + (playerLocalZ + midRegionBaseZ) + "@gre@)", 7, i, 0xffffff, 0);
i += 14;
}
if (Config.DEBUG) {
i += 14;
this.getSurface().drawString("Camera Zoom: " + cameraZoom, 7, i, 0xffffff, 1);
i += 14;
this.getSurface().drawString("Camera Pitch: " + cameraPitch, 7, i, 0xffffff, 1);
i += 14;
this.getSurface().drawString("Camera Rotation: " + cameraRotation, 7, i, 0xffffff, 1);
int cameraX = this.cameraPositionX + this.cameraAutoMoveX;
int cameraZ = this.cameraPositionZ + this.cameraAutoMoveZ;
int cameraY = -this.world.getElevation(cameraX, cameraZ) - 170;
i += 14;
this.getSurface().drawString("Frame: " + cameraAutoMoveFrameCount, 7, i, 0xffffffff, 1);
i += 14;
this.getSurface().drawString("Camera X: " + cameraX + " (" + this.cameraPositionX + " + " + this.cameraAutoMoveX + ") [" + this.localPlayer.currentX + "] [" + cameraAutoMoveAmountX + "]", 7, i, 0xffffff, 1);
i += 14;
this.getSurface().drawString("Camera Z: " + cameraZ + " (" + this.cameraPositionZ + " + " + this.cameraAutoMoveZ + ") [" + this.localPlayer.currentZ + "] [" + cameraAutoMoveAmountZ + "]", 7, i, 0xffffff, 1);
i += 14;
this.getSurface().drawString("Camera Y: " + cameraY, 7, i, 0xffffff, 1);
}
if (S_SIDE_MENU_TOGGLE && C_SIDE_MENU_OVERLAY) {
showSideMenu();
} else {
hideSideMenu();
}
if (S_EXPERIENCE_COUNTER_TOGGLE && C_EXPERIENCE_COUNTER == 2) {
......@@ -16135,10 +16047,18 @@ public final class mudclient implements Runnable {
public final void hidePartyMenu() {
partyMenu.hide();
}
public final void hideSideMenu() {
sideMenu.hide();
}
public final void showPartyMenu() {
partyMenu.show();
}
public final void showSideMenu() {
sideMenu.show();
}
public final void initializeBatchProgressVariables(int repeatFor, int delay) {
batchProgressBar.initVariables(repeatFor, delay);
......@@ -17015,6 +16935,12 @@ public final class mudclient implements Runnable {
public int getF2OppName() {
return this.f2OppName;
}
public int getPlayerLocalX() {
return this.playerLocalX;
}
public int getPlayerLocalZ() {
return this.playerLocalZ;
}
public int getOp() {
return this.oP;
}
......@@ -17529,6 +17455,9 @@ public final class mudclient implements Runnable {
partyMenu = new PartyGUI(this);
mainComponent.addComponent(partyMenu.getComponent());
sideMenu = new SideMenu(this);
mainComponent.addComponent(sideMenu.getComponent());
if (S_BATCH_PROGRESSION) {
batchProgressBar = new ProgressBarInterface(this);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment