Files
2006Scape/2006Redone Server/src/com/rebotted/game/content/random/Holidays.java
T
Mr Extremez d876a923b9 Cleanup part 1 (#213)
* Clean up part 1

- Removed lots of dead code
- Removed unncessary files not in use
- Cleaned up small bits of code
- Removed a few warnings
- Server.java ---> GameEngine.java
- Constants.java ---> GameConstants.java

* Cape Dye

Rewrote cape dying

* Packaging

- redone ----> com.rebotted

* PacketSender/clean up

- ActionSender ---> PacketSender
- Moved many more packets to packetsender
- Cleaned up more dead code

* Merge Client/Player

- Merged Client.java with Player.java (both were doing same thing so redundant to have both)
- Removed some more dead code
- Tidy a few small things up

* Quests/more clean up

- Removed more dead code
- Made quests static in order to clean them up a bit

* More cleanup

- Removed some more of the dead quest code
- Correcting naming of some of the shop variables
2019-11-25 12:08:56 -05:00

91 lines
3.5 KiB
Java

package com.rebotted.game.content.random;
import com.rebotted.GameEngine;
import com.rebotted.event.CycleEvent;
import com.rebotted.event.CycleEventContainer;
import com.rebotted.event.CycleEventHandler;
import com.rebotted.game.players.Client;
import com.rebotted.game.players.Player;
import com.rebotted.game.players.PlayerHandler;
import com.rebotted.util.Misc;
/**
* Holiday Drops
* @author Andrew (I'm A Boss on Rune-Server, Mr Extremez on Moparscape & Runelocus)
*/
public class Holidays {
public static void startDropping(Client c) {
for (final HolidayDrops holiday : HolidayDrops.values()) {
for (Player player : PlayerHandler.players) {
if (player != null) {
Client p1 = (Client) player;
if (holiday.getHoliday()) {
if (p1.playerRights > 2) {
p1.getPacketSender().sendMessage("Currently dropping " + HolidayDrops.dropAmount() + " items.");
}
p1.getPacketSender().sendMessage("The " + holiday.getName() + " event has started, goodluck!");
dropItems(c);
}
}
}
}
}
public static void dropItems(Client client) {
CycleEventHandler.getSingleton().addEvent(client, new CycleEvent() {
@Override
public void execute(CycleEventContainer container) {
for (int j = 0; j < PlayerHandler.players.length; j++) {
if (PlayerHandler.players[j] != null) {
Client p1 = (Client) PlayerHandler.players[j];
for (HolidayDrops holiday : HolidayDrops.values()) {
if (holiday.count >= HolidayDrops.dropAmount() && holiday.getHoliday()) {
stop();
p1.getPacketSender().sendMessage("The " + holiday.getName() + " event has ended, good luck finding the rest of the items!");
} else if (holiday.count < HolidayDrops.dropAmount() && holiday.getHoliday()) {
switch (Misc.random(holiday.drops)) {
case 0:// Varrock
GameEngine.itemHandler.createGroundItem(p1, holiday.getItem(), 3214 + Misc.random(holiday.DROP_DISTANCE), 3424 - Misc.random(holiday.DROP_DISTANCE), 1, j);
holiday.count++;
break;
case 1:// Lumbridge
GameEngine.itemHandler.createGroundItem(p1, holiday.getItem(), 3222 + Misc.random(holiday.DROP_DISTANCE), 3218 - Misc.random(holiday.DROP_DISTANCE), 1, j);
holiday.count++;
break;
case 2:// Falador
GameEngine.itemHandler.createGroundItem(p1, holiday.getItem(), 2964 + Misc.random(holiday.DROP_DISTANCE), 3378 - Misc.random(holiday.DROP_DISTANCE), 1, j);
holiday.count++;
break;
case 3:// Barb Village
GameEngine.itemHandler.createGroundItem(p1, holiday.getItem(), 3082 + Misc.random(holiday.DROP_DISTANCE), 3419 - Misc.random(holiday.DROP_DISTANCE), 1, j);
holiday.count++;
break;
case 4:// Draynor
GameEngine.itemHandler.createGroundItem(p1, holiday.getItem(), 3082 + Misc.random(holiday.DROP_DISTANCE), 3249 - Misc.random(holiday.DROP_DISTANCE), 1, j);
holiday.count++;
break;
case 5:// Al Kharid
GameEngine.itemHandler.createGroundItem(p1, holiday.getItem(), 3293 + Misc.random(holiday.DROP_DISTANCE), 3180 - Misc.random(holiday.DROP_DISTANCE), 1, j);
holiday.count++;
break;
case 6:// Rimmington
GameEngine.itemHandler.createGroundItem(p1, holiday.getItem(), 3034 + Misc.random(holiday.DROP_DISTANCE), 3246 - Misc.random(holiday.DROP_DISTANCE), 1, j);
holiday.count++;
break;
}
}
}
}
}
}
@Override
public void stop() {
// TODO Auto-generated method stub
}
}, 2);
}
}