forked from 2009Scape/Server
Stripped Global Events Manager
This Was Responsible for Custom Game Events that shouldn't be in a remake
This commit is contained in:
parent
ba6a158ce2
commit
1681ba613a
18 changed files with 2852 additions and 3379 deletions
5695
Server/server.sql
5695
Server/server.sql
File diff suppressed because it is too large
Load diff
|
|
@ -151,8 +151,8 @@ public final class ServerConstants {
|
|||
};
|
||||
|
||||
public static final Database[] DATABASES = {
|
||||
new Database(SQLManager.SQL_SERVER_ADDRESS, DATABASE_NAMES[0], (SQLManager.LOCAL ? "root" : "username"), (SQLManager.LOCAL ? "" : "password")),
|
||||
new Database(SQLManager.SQL_SERVER_ADDRESS, DATABASE_NAMES[1], (SQLManager.LOCAL ? "root" : "username"), (SQLManager.LOCAL ? "" : "password"))
|
||||
new Database(SQLManager.SQL_SERVER_ADDRESS, DATABASE_NAMES[0], (SQLManager.LOCAL ? "dark" : "username"), (SQLManager.LOCAL ? "Pikmin123:)" : "password")),
|
||||
new Database(SQLManager.SQL_SERVER_ADDRESS, DATABASE_NAMES[1], (SQLManager.LOCAL ? "dark" : "username"), (SQLManager.LOCAL ? "Pikmin123:)" : "password"))
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package org.crandor.game.content.skill;
|
|||
import org.crandor.game.content.global.SkillcapePerks;
|
||||
import org.crandor.game.content.global.tutorial.TutorialSession;
|
||||
import org.crandor.game.content.holiday.HolidayEvent;
|
||||
import org.crandor.game.events.GlobalEvent;
|
||||
import org.crandor.game.node.entity.Entity;
|
||||
import org.crandor.game.node.entity.combat.ImpactHandler;
|
||||
import org.crandor.game.node.entity.npc.NPC;
|
||||
|
|
@ -258,7 +257,7 @@ public final class Skills {
|
|||
if (!(entity instanceof Player)) {
|
||||
return 1.0;
|
||||
}
|
||||
double mod = multiplyer ? (GlobalEvent.XP_FEVER.isActive() ? EXPERIENCE_MULTIPLIER * 2 : EXPERIENCE_MULTIPLIER) : 1;
|
||||
double mod = multiplyer ? (EXPERIENCE_MULTIPLIER) : 1;
|
||||
Player p = (Player) entity;
|
||||
if (p.getIronmanManager().getMode() == IronmanMode.ULTIMATE) {
|
||||
mod /= 4;
|
||||
|
|
@ -859,7 +858,7 @@ public int getCombatMilestone() {
|
|||
|
||||
/**
|
||||
* Sets the combatMilestones value.
|
||||
* @param combatMilestones The combatMilestones to set.
|
||||
* @param combatMilestone The combatMilestones to set.
|
||||
*/
|
||||
public void setCombatMilestone(int combatMilestone) {
|
||||
this.combatMilestone = combatMilestone;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import org.crandor.game.content.global.tutorial.TutorialStage;
|
|||
import org.crandor.game.content.skill.SkillPulse;
|
||||
import org.crandor.game.content.skill.Skills;
|
||||
import org.crandor.game.content.skill.member.summoning.familiar.Forager;
|
||||
import org.crandor.game.events.GlobalEvent;
|
||||
import org.crandor.game.node.entity.npc.NPC;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
import org.crandor.game.node.entity.player.info.portal.Perks;
|
||||
|
|
@ -180,9 +179,7 @@ public final class FishingPulse extends SkillPulse<NPC> {
|
|||
player.getSkillTasks().decreaseTask(player, SkillTasks.FTUNA1);
|
||||
player.getSkillTasks().decreaseTask(player, SkillTasks.FTUNA2);
|
||||
}
|
||||
|
||||
if (GlobalEvent.PLENTY_OF_FISH.isActive())
|
||||
player.getInventory().add(fish.getItem());
|
||||
|
||||
SkillingPets.checkPetDrop(player, SkillingPets.HERON);
|
||||
final Item item = fish.getItem();
|
||||
player.getInventory().add(item);
|
||||
|
|
@ -292,7 +289,6 @@ public final class FishingPulse extends SkillPulse<NPC> {
|
|||
|
||||
/**
|
||||
* Method used to check if the catch was a success.
|
||||
* @param player the player.
|
||||
* @return <code>True</code> if so.
|
||||
*/
|
||||
private boolean success() {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import org.crandor.game.content.global.tutorial.TutorialStage;
|
|||
import org.crandor.game.content.skill.SkillPulse;
|
||||
import org.crandor.game.content.skill.Skills;
|
||||
import org.crandor.game.content.skill.member.farming.wrapper.PatchWrapper;
|
||||
import org.crandor.game.events.GlobalEvent;
|
||||
import org.crandor.game.node.entity.impl.Projectile;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
import org.crandor.game.node.entity.player.info.portal.Perks;
|
||||
|
|
@ -343,10 +342,6 @@ public final class GatheringSkillPulse extends SkillPulse<GameObject> {
|
|||
*/
|
||||
private int calculateRewardAmount(int reward) {
|
||||
int amount = 1;
|
||||
// Event doubles resources
|
||||
if (GlobalEvent.HARVESTING_DOUBLES.isActive()) {
|
||||
amount *= 2;
|
||||
}
|
||||
|
||||
if (isMining && !isMiningEssence) {
|
||||
// Not sure what this bonus is for
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package org.crandor.game.content.skill.free.runecrafting;
|
|||
import org.crandor.game.container.impl.EquipmentContainer;
|
||||
import org.crandor.game.content.skill.SkillPulse;
|
||||
import org.crandor.game.content.skill.Skills;
|
||||
import org.crandor.game.events.GlobalEvent;
|
||||
import org.crandor.game.node.entity.impl.Animator.Priority;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
import org.crandor.game.node.entity.player.info.portal.Perks;
|
||||
|
|
@ -308,10 +307,7 @@ public final class RuneCraftPulse extends SkillPulse<Item> {
|
|||
if (player.hasPerk(Perks.RUNESTONE_KNOWLEDGE) && (altar == Altar.DEATH || altar == Altar.LAW || altar == Altar.COSMIC || altar == Altar.BLOOD || altar == Altar.NATURE)) {
|
||||
i *= 2;
|
||||
}
|
||||
|
||||
if(GlobalEvent.GOLDEN_ESSENCE.isActive()) {
|
||||
i *= 3;
|
||||
}
|
||||
|
||||
return i != 0 ? i : 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package org.crandor.game.content.skill.member.thieving;
|
|||
|
||||
import org.crandor.game.content.global.ttrail.ClueLevel;
|
||||
import org.crandor.game.content.global.ttrail.ClueScrollPlugin;
|
||||
import org.crandor.game.events.GlobalEvent;
|
||||
import org.crandor.game.node.entity.npc.NPC;
|
||||
import org.crandor.game.node.entity.npc.drop.DropFrequency;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
|
|
@ -174,11 +173,6 @@ public enum Pickpocket {
|
|||
|
||||
// Calculate any bonus multipliers
|
||||
int bonusMultiplier = 1;
|
||||
if (loot[0] == 995) {
|
||||
if(GlobalEvent.THIEVES_JACKPOT.isActive()) {
|
||||
bonusMultiplier *= 3;
|
||||
}
|
||||
}
|
||||
return new Item(loot[0], loot[1] * bonusMultiplier);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,84 +0,0 @@
|
|||
package org.crandor.game.events;
|
||||
|
||||
import org.crandor.Util;
|
||||
|
||||
public enum GlobalEvent {
|
||||
ALCHEMY_HELLENISTIC("Receive 2 x coins when using high alchemy"), // Not implemented
|
||||
GOLDEN_RETRIEVER("All gold dropped by monsters will be automatically banked for you"), // Not implemented
|
||||
THIEVES_JACKPOT("Receive 3 x more coins when thieving"),
|
||||
GOLDEN_ESSENCE("Receive 3 x more runes when runecrafting"),
|
||||
CLONE_FEST("20 clones are been spawned in the wilderness near the mage arena."), // Not implemented
|
||||
TRY_YOUR_LUCK("Mobs will drop 40% more items when killed"),
|
||||
CRAZY_SEEDS("Mobs will drop 2 x more seeds when killed"),
|
||||
CHARMED("Mobs will drop 2 x more charms when killed"),
|
||||
XP_FEVER("Receive 2 x XP for all skills"),
|
||||
PLENTY_OF_FISH("Receive 2 x rewards when fishing"),
|
||||
HARVESTING_DOUBLES("Receive 2 x items harvested with woodcutting or mining");
|
||||
|
||||
/**
|
||||
* Represents the object of the altar.
|
||||
*/
|
||||
private final String eventName;
|
||||
|
||||
/**
|
||||
* Represents the object of the altar.
|
||||
*/
|
||||
private final String eventDescription;
|
||||
|
||||
/**
|
||||
* Represents the object of the altar.
|
||||
*/
|
||||
private Long remainingTicks;
|
||||
|
||||
GlobalEvent(final String eventDescription) {
|
||||
this.eventName = Util.enumToString(this.name());;
|
||||
this.eventDescription = eventDescription;
|
||||
this.remainingTicks = 0L;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.eventName;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.eventDescription;
|
||||
}
|
||||
|
||||
public Long getRemainingTicks() {
|
||||
return this.remainingTicks;
|
||||
}
|
||||
|
||||
public GlobalEvent setRemainingTicks(Long ticks) {
|
||||
this.remainingTicks = ticks;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean isActive() {
|
||||
return this.remainingTicks > 0;
|
||||
}
|
||||
|
||||
public GlobalEvent tick() {
|
||||
remainingTicks--;
|
||||
return this;
|
||||
}
|
||||
|
||||
// Start/Extend the event
|
||||
public GlobalEvent extend() {
|
||||
return extend(6000);
|
||||
}
|
||||
|
||||
public GlobalEvent extend(int ticks) {
|
||||
remainingTicks += ticks;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GlobalEvent start() {
|
||||
return extend(6000);
|
||||
}
|
||||
|
||||
public GlobalEvent start(int ticks) {
|
||||
extend(ticks);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,234 +0,0 @@
|
|||
package org.crandor.game.events;
|
||||
|
||||
import org.crandor.Util;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
import org.crandor.game.system.task.Pulse;
|
||||
import org.crandor.game.world.GameWorld;
|
||||
import org.crandor.game.world.callback.CallBack;
|
||||
import org.crandor.game.world.repository.Repository;
|
||||
import org.crandor.tools.mysql.Results;
|
||||
|
||||
/**
|
||||
* Class to handle donated events.
|
||||
*
|
||||
* @author Vip3r
|
||||
* Version 1.0
|
||||
*/
|
||||
public class GlobalEventManager implements CallBack {
|
||||
|
||||
private long tick = 0;
|
||||
|
||||
private GlobalEvent lastEvent;
|
||||
private GlobalEvent currentEvent;
|
||||
|
||||
public final GlobalEventManager init() {
|
||||
return this;
|
||||
}
|
||||
|
||||
public final Pulse pulse() {
|
||||
|
||||
return new Pulse(1) {
|
||||
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
tick++;
|
||||
for(GlobalEvent event : GlobalEvent.values()){
|
||||
Long ticksRemaining = event.getRemainingTicks();
|
||||
if (ticksRemaining > 0) {
|
||||
event.tick();
|
||||
--ticksRemaining;
|
||||
if (ticksRemaining <= 0)
|
||||
message("The " + event.getName() + " event has now ended.");
|
||||
else if (ticksRemaining % 3000 == 0)
|
||||
message("You have " + Math.round(ticksRemaining / 100) + " minutes before the " + event.getName() + " event ends.");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (tick == 100) {
|
||||
tick = 0;
|
||||
save();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public void reActivate(GlobalEvent event, long time) {
|
||||
event.setRemainingTicks(time);
|
||||
}
|
||||
|
||||
public GlobalEventManager save() {
|
||||
for(GlobalEvent event : GlobalEvent.values()){
|
||||
|
||||
StringBuilder query = new StringBuilder();
|
||||
|
||||
query.append("INSERT INTO `global_events` ");
|
||||
query.append("(`eventName`,`eventTime`,`worldId`)");
|
||||
query.append(" VALUES(");
|
||||
|
||||
query.append("'" + event.getName() + "'").append(",");
|
||||
query.append("'" + event.getRemainingTicks() + "'").append(",");
|
||||
query.append("'" + GameWorld.getSettings().getWorldId() + "'");
|
||||
|
||||
query.append(")");
|
||||
|
||||
query.append(" ON DUPLICATE KEY UPDATE ");
|
||||
query.append("eventTime='" + event.getRemainingTicks() + "'");
|
||||
|
||||
GameWorld.getDatabaseManager().update("server", query.toString());
|
||||
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public GlobalEventManager load() {
|
||||
try {
|
||||
Results result = new Results(GameWorld.getDatabaseManager().query("server", "SELECT * FROM `global_events` WHERE worldid='" + GameWorld.getSettings().getWorldId() + "'"));
|
||||
|
||||
while (!result.empty()) {
|
||||
String eventName = result.string("eventName");
|
||||
String eventTime = result.string("eventTime");
|
||||
GlobalEvent event = getEvent(eventName);
|
||||
reActivate(event, Long.valueOf(eventTime));
|
||||
}
|
||||
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public GlobalEventManager message(String message) {
|
||||
return message(message, true, "<col=3498db>");
|
||||
}
|
||||
|
||||
public GlobalEventManager message(String message, boolean tag) {
|
||||
return message(message, tag, "<col=3498db>");
|
||||
}
|
||||
|
||||
public GlobalEventManager message(String message, boolean tag, String color) {
|
||||
for (Player player : Repository.getPlayers()) {
|
||||
player.sendMessage(color + (tag ? "[Event Manager] " : "") + message);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public GlobalEventManager deactivate(GlobalEvent event) {
|
||||
// Only deactivate event if already active
|
||||
if (!event.isActive()) {
|
||||
return this;
|
||||
}
|
||||
|
||||
// Event will end in 2 ticks
|
||||
event.setRemainingTicks(2L);
|
||||
return this;
|
||||
}
|
||||
|
||||
public GlobalEventManager activate(GlobalEvent event) {
|
||||
return activate(event, null, 6000);
|
||||
}
|
||||
|
||||
public GlobalEventManager activate(GlobalEvent event, String name) {
|
||||
return activate(event, name, 6000);
|
||||
}
|
||||
|
||||
public GlobalEventManager activate(GlobalEvent event, String name, int timeToAdd) {
|
||||
if (timeToAdd <= 0) timeToAdd = 6000;
|
||||
|
||||
Player player = Repository.getPlayerByDisplay(name);
|
||||
|
||||
StringBuilder message = new StringBuilder();
|
||||
message.append("The " + event.getName() + " event has been ");
|
||||
message.append(event.isActive() ? "extended by" : "activated for");
|
||||
message.append(" " + Math.round(timeToAdd / 100) + " minutes");
|
||||
if (player != null) {
|
||||
message.append(" by " + player.getUsername());
|
||||
}
|
||||
message.append(".");
|
||||
|
||||
// start the event after building the string
|
||||
event.start(timeToAdd);
|
||||
message(message.toString());
|
||||
message(event.getDescription(), false, "<col=ecf0f1>");
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public GlobalEventManager activateHourly(GlobalEvent event) {
|
||||
event.start(6000);
|
||||
message(event.getName() + " event is now active, and will run for an hour!");
|
||||
message(event.getDescription(), false, "<col=ecf0f1>");
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isActive(GlobalEvent event) {
|
||||
return event.isActive();
|
||||
}
|
||||
|
||||
public GlobalEventManager alert(Player player) {
|
||||
boolean active = false;
|
||||
|
||||
for(GlobalEvent event : GlobalEvent.values()){
|
||||
if (event.isActive()) {
|
||||
active = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!active) {
|
||||
player.sendMessage("<col=3498db>No events are currently active.");
|
||||
return this;
|
||||
}
|
||||
|
||||
player.sendMessage("<col=3498db>The following events are active:");
|
||||
|
||||
for(GlobalEvent event : GlobalEvent.values()){
|
||||
if (event.isActive()) {
|
||||
player.sendMessage("<col=3498db> [-] " + event.getName() + ".");
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private static GlobalEventManager INSTANCE = new GlobalEventManager();
|
||||
|
||||
public static GlobalEventManager get() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean call() {
|
||||
GameWorld.submit(pulse());
|
||||
return true;
|
||||
}
|
||||
|
||||
public static GlobalEvent getEvent(String name) {
|
||||
for(GlobalEvent event : GlobalEvent.values()){
|
||||
if (event.getName().equalsIgnoreCase(name) || event.name().equalsIgnoreCase(Util.strToEnum(name)))
|
||||
return event;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public GlobalEvent getLastEvent() {
|
||||
return lastEvent;
|
||||
}
|
||||
|
||||
public void setLastEvent(GlobalEvent event) {
|
||||
this.lastEvent = event;
|
||||
}
|
||||
|
||||
public GlobalEvent getCurrentEvent() {
|
||||
return currentEvent;
|
||||
}
|
||||
|
||||
public void setCurrentEvent(GlobalEvent event) {
|
||||
this.currentEvent = event;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -8,7 +8,6 @@ import org.crandor.game.content.eco.EconomyManagement;
|
|||
import org.crandor.game.content.eco.ge.GrandExchangeDatabase;
|
||||
import org.crandor.game.content.global.Bones;
|
||||
import org.crandor.game.content.skill.Skills;
|
||||
import org.crandor.game.events.GlobalEvent;
|
||||
import org.crandor.game.node.entity.Entity;
|
||||
import org.crandor.game.node.entity.npc.NPC;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
|
|
@ -93,12 +92,6 @@ public final class NPCDropTables {
|
|||
Player p = looter instanceof Player ? (Player) looter : null;
|
||||
for (ChanceItem item : defaultTable) {
|
||||
int amount = RandomFunction.random(item.getMinimumAmount(), item.getMaximumAmount() + 1);
|
||||
if (GlobalEvent.TRY_YOUR_LUCK.isActive())
|
||||
amount *= 1.4;
|
||||
if (GlobalEvent.CRAZY_SEEDS.isActive() && ItemDefinition.forId(item.getId()).getName().toLowerCase().contains("seed"))
|
||||
amount *= 2;
|
||||
if (GlobalEvent.CHARMED.isActive() && ItemDefinition.forId(item.getId()).getName().toLowerCase().contains("charm"))
|
||||
amount *= 2;
|
||||
if (npc.getName().startsWith("Revenant") && item.getName().equalsIgnoreCase("coins")) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -181,7 +174,7 @@ public final class NPCDropTables {
|
|||
if (handleBoneCrusher(player, item)) {
|
||||
return;
|
||||
}
|
||||
if (item.getId() == 995 && player.getBank().hasSpaceFor(item) && ( player.getGlobalData().isEnableCoinMachine() || GlobalEvent.GOLDEN_RETRIEVER.isActive() )) {
|
||||
if (item.getId() == 995 && player.getBank().hasSpaceFor(item) && ( player.getGlobalData().isEnableCoinMachine() )) {
|
||||
item = new Item(995, (int) (item.getAmount() + (item.getAmount() * 0.25)));
|
||||
player.getBank().add(item);
|
||||
player.sendMessage("<col=3498db> " + item.getAmount() + " coins were sent to your bank.");
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package org.crandor.game.node.entity.player.info.login;
|
|||
import org.crandor.game.component.CloseEvent;
|
||||
import org.crandor.game.component.Component;
|
||||
import org.crandor.game.content.global.tutorial.TutorialSession;
|
||||
import org.crandor.game.events.GlobalEventManager;
|
||||
import org.crandor.game.interaction.Option;
|
||||
import org.crandor.game.interaction.OptionHandler;
|
||||
import org.crandor.game.node.Node;
|
||||
|
|
@ -159,7 +158,6 @@ public final class LoginConfiguration {
|
|||
player.getPacketDispatch().sendMessage("You are muted.");
|
||||
player.getPacketDispatch().sendMessage("To prevent further mutes please read the rules.");
|
||||
}
|
||||
GlobalEventManager.get().alert(player);
|
||||
if(player.getSkills().getTotalLevel() < 300){
|
||||
Repository.sendNews("<col=BA55D3>As a new player, you are receiving boosted combat skill experience.</col>", "<col=BA55D3>In addition, you may speak to the Guide for game information.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
package org.crandor.game.system;
|
||||
|
||||
import org.crandor.game.events.GlobalEventManager;
|
||||
|
||||
/**
|
||||
* Handles the shutdown hook.
|
||||
* @author Emperor
|
||||
|
|
@ -14,7 +12,6 @@ public final class SystemShutdownHook implements Runnable {
|
|||
return;
|
||||
}
|
||||
SystemLogger.log("[SystemShutdownHook] Terminating...");
|
||||
GlobalEventManager.get().save();
|
||||
SystemManager.getTerminator().terminate();
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,6 @@ package org.crandor.game.system;
|
|||
import org.crandor.cache.ServerStore;
|
||||
import org.crandor.game.content.eco.ge.GEOfferDispatch;
|
||||
import org.crandor.game.content.eco.ge.GrandExchangeDatabase;
|
||||
import org.crandor.game.events.GlobalEventManager;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
import org.crandor.game.node.entity.player.info.login.PlayerParser;
|
||||
import org.crandor.game.world.repository.Repository;
|
||||
|
|
@ -43,7 +42,6 @@ public final class SystemTermination {
|
|||
public void terminate() {
|
||||
SystemLogger.log("[SystemTerminator] Initializing termination sequence - do not shutdown!");
|
||||
try {
|
||||
GlobalEventManager.get().save();
|
||||
save(getDataDirectory());
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@ import org.crandor.ServerConstants;
|
|||
import org.crandor.cache.Cache;
|
||||
import org.crandor.cache.ServerStore;
|
||||
import org.crandor.game.content.eco.ge.GrandExchangeDatabase;
|
||||
import org.crandor.game.events.GlobalEvent;
|
||||
import org.crandor.game.events.GlobalEventManager;
|
||||
import org.crandor.game.node.entity.npc.NPC;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
import org.crandor.game.node.entity.player.ai.AIPBuilder;
|
||||
|
|
@ -99,26 +97,6 @@ public final class GameWorld {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* getEvents().put("Alchemy hellenistic", 0L);
|
||||
getEvents().put("Golden retriever", 0L);
|
||||
getEvents().put("Harvesting doubles", 0L);
|
||||
getEvents().put("Thieves jackpot", 0L);
|
||||
getEvents().put("Golden essence", 0L);
|
||||
*/
|
||||
public static GlobalEvent[] hourlyEvents = {
|
||||
GlobalEvent.ALCHEMY_HELLENISTIC,
|
||||
GlobalEvent.GOLDEN_RETRIEVER,
|
||||
GlobalEvent.THIEVES_JACKPOT,
|
||||
GlobalEvent.GOLDEN_ESSENCE,
|
||||
GlobalEvent.TRY_YOUR_LUCK,
|
||||
GlobalEvent.CRAZY_SEEDS,
|
||||
GlobalEvent.CHARMED,
|
||||
GlobalEvent.XP_FEVER,
|
||||
GlobalEvent.PLENTY_OF_FISH,
|
||||
GlobalEvent.HARVESTING_DOUBLES,
|
||||
};
|
||||
|
||||
/**
|
||||
* Pulses all current pulses.
|
||||
*/
|
||||
|
|
@ -146,53 +124,7 @@ public final class GameWorld {
|
|||
}
|
||||
pulses.clear();
|
||||
ticks++;
|
||||
eventTicks++;
|
||||
cfTicks++;
|
||||
switch(cfTicks) {
|
||||
case 100:
|
||||
if (checkDay()) {
|
||||
// Activate clone fest for 15 minutes
|
||||
GlobalEventManager.get().activate(GlobalEvent.CLONE_FEST, null, 1500);
|
||||
if (GlobalEvent.CLONE_FEST.isActive()) {
|
||||
int size = 20;
|
||||
if (PVPAIPActions.pvp_players == null) {
|
||||
PVPAIPActions.pvp_players = new ArrayList<>();
|
||||
}
|
||||
for (int i = 0; i < size; i++) {
|
||||
String aipName = PVPAIPBuilderUtils.names[i];
|
||||
final AIPlayer aip = AIPBuilder.create(aipName, generateLocation());
|
||||
aip.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE);
|
||||
Repository.getPlayers().add(aip);
|
||||
aip.init();
|
||||
PVPAIPBuilderUtils.generateClass(aip);
|
||||
|
||||
if (PVPAIPActions.pvp_players.isEmpty()) {
|
||||
aip.setAttribute("aip_legion", PVPAIPActions.pvp_players);
|
||||
}
|
||||
PVPAIPActions.pvp_players.add(aip);
|
||||
}
|
||||
PVPAIPActions.syncBotThread(null);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2100:
|
||||
cfTicks = 0;
|
||||
break;
|
||||
}
|
||||
switch (eventTicks) {
|
||||
// 2 minute gap between events
|
||||
case 200:
|
||||
int randomEventId = new Random().nextInt(hourlyEvents.length);
|
||||
GlobalEvent event = hourlyEvents[randomEventId];
|
||||
|
||||
GlobalEventManager.get().setLastEvent(event);
|
||||
GlobalEventManager.get().setCurrentEvent(event);
|
||||
GlobalEventManager.get().activateHourly(event);
|
||||
break;
|
||||
case 6200:
|
||||
eventTicks = 0;
|
||||
break;
|
||||
}
|
||||
for (Player p : Repository.getPlayers()) {
|
||||
if (p.isPlaying()) {
|
||||
switch (RandomFunction.getRandom(1000)) {
|
||||
|
|
@ -268,7 +200,6 @@ public final class GameWorld {
|
|||
SQLManager.prePlugin();
|
||||
ScriptManager.load();
|
||||
PluginManager.init();
|
||||
GlobalEventManager.get().init();
|
||||
ResourceAIPManager.get().init();
|
||||
SQLManager.postPlugin();
|
||||
parseObjects();
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import org.crandor.game.content.eco.ge.GEOfferDispatch;
|
|||
import org.crandor.game.content.holiday.HolidayEvent;
|
||||
import org.crandor.game.content.skill.member.farming.FarmingPulse;
|
||||
import org.crandor.game.content.skill.member.hunter.ImpetuousImpulses;
|
||||
import org.crandor.game.events.GlobalEventManager;
|
||||
import org.crandor.game.system.SystemLogger;
|
||||
import org.crandor.game.world.map.zone.ZoneBuilder;
|
||||
|
||||
|
|
@ -41,7 +40,6 @@ public final class CallbackHub {
|
|||
calls.add(new GEOfferDispatch());
|
||||
calls.add(new FarmingPulse());
|
||||
calls.add(new ImpetuousImpulses());
|
||||
calls.add(GlobalEventManager.get());
|
||||
for (CallBack call : calls) {
|
||||
if (!call.call()) {
|
||||
SystemLogger.error("A callback was stopped, callback=" + call.getClass().getSimpleName() + ".");
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@ import org.crandor.game.content.skill.Skills;
|
|||
import org.crandor.game.content.skill.free.smithing.smelting.Bar;
|
||||
import org.crandor.game.content.skill.member.construction.HouseLocation;
|
||||
import org.crandor.game.content.skill.member.summoning.pet.Pets;
|
||||
import org.crandor.game.events.GlobalEvent;
|
||||
import org.crandor.game.events.GlobalEventManager;
|
||||
import org.crandor.game.node.entity.combat.ImpactHandler.HitsplatType;
|
||||
import org.crandor.game.node.entity.npc.NPC;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
|
|
@ -99,9 +97,6 @@ public final class DeveloperCommandPlugin extends CommandPlugin {
|
|||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean parse(final Player player, String name, String[] args) {
|
||||
String[] eventNameArr;
|
||||
String eventName;
|
||||
GlobalEvent event = GlobalEvent.ALCHEMY_HELLENISTIC;
|
||||
switch (name) {
|
||||
case "find":
|
||||
try {
|
||||
|
|
@ -155,9 +150,6 @@ public final class DeveloperCommandPlugin extends CommandPlugin {
|
|||
}
|
||||
});
|
||||
break;
|
||||
case "eventlocator":
|
||||
player.getDialogueInterpreter().open(175869, GlobalEventManager.get().getCurrentEvent());
|
||||
break;
|
||||
case "drops":
|
||||
try {
|
||||
new NPCDropSQLHandler().parse();
|
||||
|
|
@ -176,66 +168,12 @@ public final class DeveloperCommandPlugin extends CommandPlugin {
|
|||
player.sendMessage("You have " + player.getSkillTasks().getTaskAmount() + " more to go!");
|
||||
break;
|
||||
|
||||
case "eventactivate":
|
||||
case "eventstart":
|
||||
case "eventbegin":
|
||||
case "activateevent":
|
||||
case "startevent":
|
||||
case "beginevent":
|
||||
eventNameArr = Arrays.copyOfRange(args, 1, args.length);
|
||||
eventName = String.join(" ", eventNameArr);
|
||||
event = GlobalEventManager.getEvent(eventName);
|
||||
if (event == null)
|
||||
break;
|
||||
GlobalEventManager.get().activate(event);
|
||||
player.sendMessage("You have activated the " + event.getName() + " event!");
|
||||
break;
|
||||
|
||||
case "eventdeactivate":
|
||||
case "eventend":
|
||||
case "eventfinish":
|
||||
case "deactivateevent":
|
||||
case "endevent":
|
||||
case "finishevent":
|
||||
eventNameArr = Arrays.copyOfRange(args, 1, args.length);
|
||||
eventName = String.join(" ", eventNameArr);
|
||||
event = GlobalEventManager.getEvent(eventName);
|
||||
if (event == null)
|
||||
break;
|
||||
GlobalEventManager.get().deactivate(event);
|
||||
player.sendMessage("You have deactivated the " + event.getName() + " event!");
|
||||
break;
|
||||
|
||||
case "poison":
|
||||
player.getStateManager().set(EntityState.POISONED, 200, player);
|
||||
player.getConfigManager().set(102, 1);
|
||||
player.sendMessage("Poisoned...");
|
||||
break;
|
||||
|
||||
case "activatecf":
|
||||
GlobalEventManager.get().activate(GlobalEvent.CLONE_FEST);
|
||||
if (GlobalEvent.CLONE_FEST.isActive()) {
|
||||
int size = 20;
|
||||
if (PVPAIPActions.pvp_players == null) {
|
||||
player.setAttribute("aip_legion", PVPAIPActions.pvp_players = new ArrayList<>());
|
||||
}
|
||||
for (int i = 0; i < size; i++) {
|
||||
String aipName = PVPAIPBuilderUtils.names[i];
|
||||
final AIPlayer aip = AIPBuilder.create(aipName, generateLocation(player));
|
||||
aip.setControler(player);
|
||||
aip.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE);
|
||||
Repository.getPlayers().add(aip);
|
||||
aip.init();
|
||||
PVPAIPBuilderUtils.generateClass(aip);
|
||||
|
||||
if (PVPAIPActions.pvp_players.isEmpty()) {
|
||||
aip.setAttribute("aip_legion", PVPAIPActions.pvp_players);
|
||||
}
|
||||
PVPAIPActions.pvp_players.add(aip);
|
||||
}
|
||||
PVPAIPActions.syncBotThread(player);
|
||||
}
|
||||
break;
|
||||
case "reloaddb":
|
||||
SQLManager.init();
|
||||
player.sendMessage("[MySQl] The database has been reloaded.");
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@ package plugin.command;
|
|||
|
||||
import org.crandor.ServerConstants;
|
||||
import org.crandor.game.component.Component;
|
||||
import org.crandor.game.events.GlobalEvent;
|
||||
import org.crandor.game.events.GlobalEventManager;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
import org.crandor.game.node.entity.player.info.Rights;
|
||||
import org.crandor.game.node.entity.player.link.IronmanMode;
|
||||
|
|
@ -188,11 +186,6 @@ public final class PlayerCommandPlugin extends CommandPlugin {
|
|||
sendDonationInfo(player);
|
||||
return true;
|
||||
|
||||
case "events":
|
||||
GlobalEventManager.get().alert(player);
|
||||
sendEvents(player);
|
||||
return true;
|
||||
|
||||
case "reply":
|
||||
if(player.getInterfaceManager().isOpened()){
|
||||
player.sendMessage("<col=e74c3c>Please finish what you're doing first.");
|
||||
|
|
@ -289,33 +282,6 @@ public final class PlayerCommandPlugin extends CommandPlugin {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends events list.
|
||||
* @param player the player.
|
||||
*/
|
||||
private void sendEvents(Player player) {
|
||||
if (player.getInterfaceManager().isOpened()) {
|
||||
player.sendMessage("Finish what you're currently doing.");
|
||||
return;
|
||||
}
|
||||
player.getInterfaceManager().open(new Component(275));
|
||||
//CLear old data
|
||||
for (int i = 0; i < 311; i++) {
|
||||
player.getPacketDispatch().sendString("", 275, i);
|
||||
}
|
||||
// Title
|
||||
player.getPacketDispatch().sendString("<col=ecf0f1>" + GameWorld.getName() + " Events</col>", 275, 2);
|
||||
|
||||
// Content
|
||||
int lineId = 11;
|
||||
for(GlobalEvent event : GlobalEvent.values()){
|
||||
player.getPacketDispatch().sendString("<col=ecf0f1>" + event.getName(), 275, lineId++);
|
||||
if (event.isActive())
|
||||
player.getPacketDispatch().sendString("<col=8e44ad>(active)", 275, lineId++);
|
||||
player.getPacketDispatch().sendString("<col=2c3e50>" + event.getDescription(), 275, lineId++);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the yell prefix for the given player.
|
||||
* @param player The player.
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import org.crandor.game.component.ComponentDefinition;
|
|||
import org.crandor.game.component.ComponentPlugin;
|
||||
import org.crandor.game.content.global.Lamps;
|
||||
import org.crandor.game.content.skill.Skills;
|
||||
import org.crandor.game.events.GlobalEvent;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
import org.crandor.game.node.entity.player.link.audio.Audio;
|
||||
import org.crandor.game.node.item.Item;
|
||||
|
|
@ -87,7 +86,7 @@ public final class ExperienceLampInterface extends ComponentPlugin {
|
|||
experience /= 2;
|
||||
}
|
||||
} else {
|
||||
player.getDialogueInterpreter().open(70099, new Object[] { "The lamp gives you " + (experience * (Skills.EXPERIENCE_MULTIPLIER * (GlobalEvent.XP_FEVER.isActive() ? 2 : 1))) + " " + Skills.SKILL_NAME[skillType.skill] + " experience." });
|
||||
player.getDialogueInterpreter().open(70099, new Object[] { "The lamp gives you " + (experience * (Skills.EXPERIENCE_MULTIPLIER)) + " " + Skills.SKILL_NAME[skillType.skill] + " experience." });
|
||||
}
|
||||
player.getSkills().addExperience(skillType.skill, experience, false);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue