Jump to content
  • 0
Sign in to follow this  
squashy

AdvancedCasket.java problems

Question

Okay so there's no problem that i can see and there's no errors that the compiler can pick up, but this doesn't seem to affect the casket in anyway. This is all saved in a file called AdvancedCasket.java and yes i have edit clickitem.java, but this doesnt work can anyone help out or point if i have done something wrong.

AdvancedCasket.java:

[Code]package server.model.players;

import server.model.players.Client;
import server.event.EventManager;
import server.event.Event;
import server.event.EventContainer;
import server.util.Misc;

public class AdvancedCasket{

public static boolean Canusebox = true;

public static int Common [] =
{4587, 3751, 4131, 2572, 7927, 1321, 1333, 1631, 1619, 1621, 1623, 1625, 1323, 542, 544, 3179, 536, 534, 383, 385 }; // Add more item Id's

public static int Uncommon [] =
{9185, 11732, 4732, 4087, 3481, 3483, 3486, 3488, 2669, 2671, 2673, 2675, 2677, 2653, 2655, 2657, 2659, 2661, 1079, 1093, 1113, 1127, 1147, 1163, 1185, 1201, 2591, 2593, 2595, 2597, 2607, 2609, 2611, 2613}; // Add more item Id's

public static int Rare [] =
{4151, 1038, 1040, 1042, 1044, 1046, 1048, 6585, 2615, 2617, 2619, 2621, 7386, 7390, 7394}; // Add more item Id's


public static int GenerateCasketPrize(final Client c) {
EventManager.getSingleton().addEvent(new Event() {
int BoxTimer = 2;
int Coins = 500000 + Misc.random(500000);
public void execute(EventContainer Box) {
Canusebox = false;
if (BoxTimer == 1) {
c.sendMessage("Retreiving your prize...");
}
if (BoxTimer == 0) {
c.getItems().addItem(995, Coins);
int Random = Misc.random(100);
if (Random <= 64) {
c.getItems().addItem(Common[(int) (Math.random() * Common.length)], 1);
c.sendMessage("Bad luck... You have recieved a [MENTION=231]red[/MENTION]@common [MENTION=24291]bla[/MENTION]@item and [MENTION=112005]Blu[/MENTION]@"+ Coins +" [MENTION=24291]bla[/MENTION]@coins.");
} else if (Random >= 65 && Random <= 89) {
c.getItems().addItem(Uncommon[(int) (Math.random() * Uncommon.length)], 1);
c.sendMessage("not bad! You have recieved an @[email protected] [MENTION=24291]bla[/MENTION]@item and [MENTION=112005]Blu[/MENTION]@"+ Coins +" [MENTION=24291]bla[/MENTION]@coins.");
} else if (Random >= 90 && Random <= 100) {
c.getItems().addItem(Rare[(int) (Math.random() * Rare.length)], 1);
c.sendMessage(" What luck! you have recieved an [MENTION=112005]Blu[/MENTION]@rare [MENTION=24291]bla[/MENTION]@item and [MENTION=112005]Blu[/MENTION]@"+ Coins +" [MENTION=24291]bla[/MENTION]@coins.");
}
}
if (c == null || BoxTimer <= 0) {
Box.stop();
Canusebox = true;
return;
}
if (BoxTimer >= 0) {
BoxTimer--;
}
}
}, 1000);
return Common[(int) (Math.random() * Common.length)];
}

public static void Open(int itemID, Client c) {
if (itemID == 405) {
if (c.getItems().freeSlots() > 1) {
if (Canusebox == true) {
c.getItems().deleteItem(405, 1);
GenerateMyrsteryPrize(c);
} else {
c.sendMessage("Please wait a few seconds before clicking this item again.");
}
} else {
c.sendMessage("You need 2 free inventory slots.");
}

}
}

}[/Code]

Clickitem.java:

[Code] if (itemId == 405)
if (c.getItems().playerHasItem(405)) {
AdvancedCasket.Open(itemId, c);
return;
}[/code] Edited by squashy

Share this post


Link to post
Share on other sites

25 answers to this question

Recommended Posts

  • 0
[quote name='squashy']Casket still wont open :/[/QUOTE]

Import your project into an IDE and see if anything shows up from the IDE.

Share this post


Link to post
Share on other sites
  • 0
[quote name='Arbatel']Import your project into an IDE and see if anything shows up from the IDE.[/QUOTE]

uhm i dont really know what a IDE is and how to use one :/ only been in the Coding world for 4 months or so. if it requires eclipse i have that. Edited by squashy

Share this post


Link to post
Share on other sites
  • 0
[quote name='squashy']uhm i dont really know what a IDE is and how to use one :/ only been in the Coding world for 4 months or so. if it requires eclipse i have that.[/QUOTE]

Eclipse is an IDE, yes. Import your project into that (unless it's already in there) and then tell me if it returns anything to you.

Share this post


Link to post
Share on other sites
  • 0
[quote name='Arbatel']Eclipse is an IDE, yes. Import your project into that (unless it's already in there) and then tell me if it returns anything to you.[/QUOTE]

Oh my it had a few errors, and it found alot more errors i was unaware of thanks bro! just made my life a whole lot more easier :')

Share this post


Link to post
Share on other sites
  • 0
[quote name='squashy']Oh my it had a few errors, and it found alot more errors i was unaware of thanks bro! just made my life a whole lot more easier :')[/QUOTE]

This is why I love IDE's. Providing help since their creation! If there's anything more I'll look at the thread tomorrow, going to sleep now. Have fun!

Share this post


Link to post
Share on other sites
  • 0
[quote name='Arbatel']This is why I love IDE's. Providing help since their creation! If there's anything more I'll look at the thread tomorrow, going to sleep now. Have fun![/QUOTE]

Haha, Thanks mate.

Share this post


Link to post
Share on other sites
  • 0
[quote name='squashy']Haha, Thanks mate.[/QUOTE]

Does it work now? If it doesn't work I'll look into it further.

Share this post


Link to post
Share on other sites
  • 0
How did the IDE find errors or warnings that the command line interpreter not find?

Share this post


Link to post
Share on other sites
  • 0
[quote name='kohlrak']How did the IDE find errors or warnings that the command line interpreter not find?[/QUOTE]

I dont know, use an IDE showed up with 22 problems but the compiler could only find 3 and those 3 problems had nothing to do with what i was trying to fix.

[quote name='FalconPunch']Does it work now? If it doesn't work I'll look into it further.[/QUOTE]

No it still doesn't work but the IDE cant find anything and my compiler still cant find anything :(

Share this post


Link to post
Share on other sites
  • 0
[quote name='squashy']I dont know, use an IDE showed up with 22 problems but the compiler could only find 3 and those 3 problems had nothing to do with what i was trying to fix.



No it still doesn't work but the IDE cant find anything and my compiler still cant find anything :([/QUOTE]
If I finish my assignments I'll try and fix it for you.

Share this post


Link to post
Share on other sites
Sign in to follow this  

×