Commit 8354cedc authored by Scott T's avatar Scott T

makes all beds work with freezing exp. moves notification to the status screen.

parent 847f02af
......@@ -3404,7 +3404,7 @@ public class EntityHandler {
items.add(new ItemDef("Mithril Pickaxe", "Requires level 21 mining to use", "", 1300, 72, "items:72", false, false, 0, 10072780, false, false, 2077, -1, 1260));
items.add(new ItemDef("Adamantite Pickaxe", "Requires level 31 mining to use", "", 3200, 72, "items:72", false, false, 0, 11717785, false, false, 2078, -1, 1261));
items.add(new ItemDef("Rune Pickaxe", "Requires level 41 mining to use", "", 32000, 72, "items:72", false, false, 0, 65535, false, false, 2079, -1, 1262));
items.add(new ItemDef("Sleeping Bag", "Not as comfy as a bed but better than nothing", Config.S_WANT_FATIGUE ? "sleep" : "toggle exp", 30, 422, "items:422", false, false, 0, 0, false, false, 2080, -1, 1263));
items.add(new ItemDef("Sleeping Bag", "Not as comfy as a bed but better than nothing", "sleep", 30, 422, "items:422", false, false, 0, 0, false, false, 2080, -1, 1263));
items.add(new ItemDef("A blue wizards hat", "An ancient wizards hat.", "", 2, 86, "items:86", false, true, 32, 255, true, true, -1, -1, 1264));
items.add(new ItemDef("Gilded Totem Pole", "A well crafted totem pole - given to you as a gift from Gujuo", "Inspect", 20, 403, "items:403", false, false, 0, 65280, true, true, -1, -1, 1265));
items.add(new ItemDef("Blessed Golden Bowl", "A specially made bowl constructed out of pure gold - it looks magical somehow", "", 1000, 404, "items:404", false, false, 0, 0, true, true, -1, -1, 1266));
......
......@@ -7153,17 +7153,6 @@ public final class mudclient implements Runnable {
this.drawMenu();
}
}
//draw experience freeze message
if (this.experienceOff) {
this.getSurface().drawColoredString(
this.getSurface().width2 - 218 - getSurface().stringWidth(1,"YOUR EXPERIENCE GAIN IS DISABLED"),
25,
"YOUR EXPERIENCE GAIN IS DISABLED",
1,
0x00FF0000,
-1
);
}
this.mouseButtonClick = 0;
} catch (RuntimeException var4) {
throw GenUtil.makeThrowable(var4, "client.DC(" + var1 + ')');
......@@ -10037,8 +10026,13 @@ public final class mudclient implements Runnable {
heightMargin += 12;
this.getSurface().drawString("Combat level: " + this.localPlayer.level, 5 + x, heightMargin, textColour, 1);
heightMargin += 12;
//if there is a skill hovered over
} else {
//exp freeze notification
if (experienceOff)
this.getSurface().drawString("XP GAIN OFF", 122+x, yOffset + 8, 0x00FF0000, 1);
else
this.getSurface().drawString("XP GAIN ON", 124+x, yOffset + 8, 0x0000FF00, 1);
} else {//if there is a skill hovered over
this.getSurface().drawString(this.skillNameLong[currentlyHoveredSkill] + " skill", 5 + x, heightMargin, textColourHeading, 1);
heightMargin += 12;
int nextLevelExp = this.experienceArray[0];
......
......@@ -3397,7 +3397,7 @@ public class EntityHandler {
items.add(new ItemDef("Mithril Pickaxe", "Requires level 21 mining to use", "", 1300, 72, "items:72", false, false, 0, 10072780, false, false, 2077, -1, 1260));
items.add(new ItemDef("Adamantite Pickaxe", "Requires level 31 mining to use", "", 3200, 72, "items:72", false, false, 0, 11717785, false, false, 2078, -1, 1261));
items.add(new ItemDef("Rune Pickaxe", "Requires level 41 mining to use", "", 32000, 72, "items:72", false, false, 0, 65535, false, false, 2079, -1, 1262));
items.add(new ItemDef("Sleeping Bag", "Not as comfy as a bed but better than nothing", Config.S_WANT_FATIGUE ? "sleep" : "toggle exp", 30, 422, "items:422", false, false, 0, 0, false, false, 2080, -1, 1263));
items.add(new ItemDef("Sleeping Bag", "Not as comfy as a bed but better than nothing", "sleep", 30, 422, "items:422", false, false, 0, 0, false, false, 2080, -1, 1263));
items.add(new ItemDef("A blue wizards hat", "An ancient wizards hat.", "", 2, 86, "items:86", false, true, 32, 255, true, true, -1, -1, 1264));
items.add(new ItemDef("Gilded Totem Pole", "A well crafted totem pole - given to you as a gift from Gujuo", "Inspect", 20, 403, "items:403", false, false, 0, 65280, true, true, -1, -1, 1265));
items.add(new ItemDef("Blessed Golden Bowl", "A specially made bowl constructed out of pure gold - it looks magical somehow", "", 1000, 404, "items:404", false, false, 0, 0, true, true, -1, -1, 1266));
......
......@@ -7021,18 +7021,6 @@ public final class mudclient implements Runnable {
this.drawMenu();
}
}
//draw experience freeze message
if (this.experienceOff) {
this.getSurface().drawColoredString(
this.getSurface().width2 - 218 - getSurface().stringWidth(1,"YOUR EXPERIENCE GAIN IS DISABLED"),
25,
"YOUR EXPERIENCE GAIN IS DISABLED",
1,
0x00FF0000,
-1
);
}
this.mouseButtonClick = 0;
} catch (RuntimeException var4) {
throw GenUtil.makeThrowable(var4, "client.DC(" + var1 + ')');
......@@ -9867,7 +9855,6 @@ public final class mudclient implements Runnable {
this.getSurface().drawString("Fatigue: @yel@" + this.statFatigue + "%", xOffset, yOffset,
textColour, 1);
}
yOffset += 20;
this.getSurface().drawString("Equipment Status", 5 + x, yOffset, textColourHeading, 3);
yOffset += 13;
......@@ -9906,8 +9893,13 @@ public final class mudclient implements Runnable {
heightMargin += 12;
this.getSurface().drawString("Combat level: " + this.localPlayer.level, 5 + x, heightMargin, textColour, 1);
heightMargin += 12;
//if there is a skill hovered over
} else {
//exp freeze notification
if (experienceOff)
this.getSurface().drawString("XP GAIN OFF", 122+x, yOffset + 8, 0x00FF0000, 1);
else
this.getSurface().drawString("XP GAIN ON", 124+x, yOffset + 8, 0x0000FF00, 1);
} else {//if there is a skill hovered over
this.getSurface().drawString(this.skillNameLong[currentlyHoveredSkill] + " skill", 5 + x, heightMargin, textColourHeading, 1);
heightMargin += 12;
int nextLevelExp = this.experienceArray[0];
......
......@@ -28,8 +28,7 @@ public class InvAction extends Functions implements InvActionListener, InvAction
ItemId.SHAMAN_ROBE.id(), ItemId.SPELL_SCROLL.id(), ItemId.BOOK_OF_EXPERIMENTAL_CHEMISTRY.id(),
ItemId.LEVEL_1_CERTIFICATE.id(), ItemId.LEVEL_2_CERTIFICATE.id(), ItemId.LEVEL_3_CERTIFICATE.id(),
ItemId.DIGSITE_SCROLL.id(), ItemId.ASTROLOGY_BOOK.id(), ItemId.STONE_TABLET.id(),
ItemId.OYSTER.id(), ItemId.SCRUMPLED_PIECE_OF_PAPER.id())
|| (item.getID() == ItemId.SLEEPING_BAG.id() && !Constants.GameServer.WANT_FATIGUE);
ItemId.OYSTER.id(), ItemId.SCRUMPLED_PIECE_OF_PAPER.id());
}
@Override
......@@ -131,20 +130,8 @@ public class InvAction extends Functions implements InvActionListener, InvAction
else if (id == ItemId.STONE_TABLET.id())
handleStoneTablet(player);
else if (id == ItemId.SLEEPING_BAG.id())
handleSleepingBag(player);
}
private void handleSleepingBag(Player player) {
ActionSender.sendEnterSleep(player);
player.startSleepEvent(false);
player.toggleFreezeXp();
ActionSender.sendExperienceToggle(player, player.isExperienceFrozen());
if (player.isExperienceFrozen())
player.message("@red@You have DISABLED experience gain!");
else
player.message("@gre@You have ENABLED experience gain!");
}
private void handleOyster(Player player, int oyster) {
player.message("you open the oyster shell");
if (DataConversions.random(0, 10) == 1) {
......
......@@ -75,7 +75,7 @@ public class ItemActionHandler implements PacketHandler {
return;
}
if (item.getID() == ItemId.SLEEPING_BAG.id() && Constants.GameServer.WANT_FATIGUE && !player.isSleeping()) {
if (item.getID() == ItemId.SLEEPING_BAG.id() && !player.isSleeping()) {
ActionSender.sendEnterSleep(player);
player.startSleepEvent(false);
// player.resetPath(); - real rsc.
......
package com.openrsc.server.net.rsc.handlers;
import com.openrsc.server.Constants;
import com.openrsc.server.Server;
import com.openrsc.server.event.SingleEvent;
import com.openrsc.server.model.entity.player.Player;
......@@ -37,6 +38,11 @@ public final class SleepHandler implements PacketHandler {
// Advance the fatigue expert part of tutorial island
if(player.getCache().hasKey("tutorial") && player.getCache().getInt("tutorial") == 85)
player.getCache().set("tutorial", 86);
//Handle exp toggle for servers without fatigue
if (!Constants.GameServer.WANT_FATIGUE) {
handleExpToggle(player);
}
} else {
ActionSender.sendIncorrectSleepword(player);
player.incrementSleepTries();
......@@ -56,4 +62,13 @@ public final class SleepHandler implements PacketHandler {
}
}
}
private void handleExpToggle(Player player) {
player.toggleFreezeXp();
ActionSender.sendExperienceToggle(player, player.isExperienceFrozen());
if (player.isExperienceFrozen())
player.message("You have @red@DISABLED@whi@ experience gain!");
else
player.message("You have @gre@ENABLED@whi@ experience gain!");
}
}
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