can u add multiplayer support for using the scroll? will --rep++ :luke132:Quote:
Originally Posted by Aaron W [Only registered and activated users can see links. Click Here To Register...]Just a little snippet, thought it be useful to somebody eventually.
ok so first go to player.java and add your boolean
Spoiler for player.java:public boolean doubleScroll ;
then go to playersave.java and add
Spoiler for playersave.java:} else if (token.equals("doubleXpScroll")) {
p.doubleScroll = Boolean.parseBoolean(token2);
and
characterfile.write("doubleXpScroll = ", 0, 17);
characterfile.write(Boolean.toString(p.doubleScrol l ), 0, Boolean.toString(p.doubleScroll ).length());
characterfile.newLine();
then go make the actual class called DoubleExpScroll and add this
Spoiler for DoubleExpScroll.java:package ethos.model.content;
import java.util.concurrent.TimeUnit;
import ethos.Config;
import ethos.model.players.Player;
/**
* @author Aaron Whittle
* @date Sep 22th 2019
*/
public class DoubleExpScroll {
public static long EXPERIENCE_TIMER = 0;
public static void OpenScroll (Player player) {
EXPERIENCE_TIMER = TimeUnit.HOURS.toMillis(1) / 600;
player.doubleScroll = true;
}
public void EndExp (Player player) {
if (DoubleExpScroll.EXPERIENCE_TIMER > 0) {
DoubleExpScroll.EXPERIENCE_TIMER--;
if (DoubleExpScroll.EXPERIENCE_TIMER == 1) {
player.sendMessage("@[email protected] are no longer on double experience.");
player.doubleScroll = false;
}
}
}
}
Then lastly just go to where you handle your item options, in this case it is Itemoptionone.java and add
Spoiler for ItemOptionOne.java:case 2841:
if (c.doubleScroll == false && c.getItems().playerHasItem(2841)) {
c.getItems().deleteItem(2841, 1);
DoubleExpScroll.OpenScroll(c);
c.sendMessage("@[email protected] have activated 1 hour of double experience.");
} else if (c.doubleScroll == true) {
c.sendMessage("@[email protected] already activated this.");
}
break;
Feel free to change the id of the scroll, it isnt the best one.
