mirror of
https://github.com/moparisthebest/MoparClassic
synced 2024-11-11 11:45:09 -05:00
Moved some variables from Constants to Config, and made them configurable via XML.
This commit is contained in:
parent
5fc6663ec2
commit
bee6a45477
@ -24,7 +24,13 @@ public class Config {
|
||||
public static int SERVER_PORT, SERVER_VERSION, MAX_PLAYERS, LS_PORT, SERVER_NUM;
|
||||
|
||||
public static long START_TIME;
|
||||
|
||||
|
||||
public static boolean members, f2pWildy;
|
||||
|
||||
public static double expRate, subExpRate;
|
||||
|
||||
public static String[] pmods, mods, admins;
|
||||
|
||||
static {
|
||||
loadEnv();
|
||||
}
|
||||
@ -60,8 +66,20 @@ public class Config {
|
||||
LS_IP = props.getProperty("lsip");
|
||||
LS_PORT = Integer.parseInt(props.getProperty("lsport"));
|
||||
SERVER_NUM = Integer.parseInt(props.getProperty("servernum"));
|
||||
|
||||
|
||||
members = Boolean.parseBoolean(props.getProperty("members", "false"));
|
||||
f2pWildy = Boolean.parseBoolean(props.getProperty("f2pWildy", "true"));
|
||||
expRate = Double.parseDouble(props.getProperty("expRate"));
|
||||
subExpRate = Double.parseDouble(props.getProperty("subExpRate"));
|
||||
|
||||
pmods = props.getProperty("pmods").replaceAll(", +", ",").split(",");
|
||||
mods = props.getProperty("mods").replaceAll(", +", ",").split(",");
|
||||
admins = props.getProperty("admins").replaceAll(", +", ",").split(",");
|
||||
|
||||
props.clear();
|
||||
|
||||
Constants.GameServer.MOTD = "@yel@Welcome to @whi@" + Config.SERVER_NAME + "@yel@ - World @whi@" + (Config.SERVER_NUM == 0 ? 2 : Config.SERVER_NUM) + " (" + (Config.members ? "P2P" : "F2P") + ")";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -13,40 +13,10 @@ public class Constants {
|
||||
* @category GameServer
|
||||
*/
|
||||
public static class GameServer {
|
||||
/**
|
||||
* Used throughout strings ingame, this is your Server's name.
|
||||
*/
|
||||
public static final String SERVER_NAME = "MoparScape Classic";
|
||||
/**
|
||||
* Set by runtime arguments. Is this World a Members/Subscriber (P2P)
|
||||
* world?
|
||||
*/
|
||||
public static boolean MEMBER_WORLD = false;
|
||||
/**
|
||||
* Is this wilderness fully f2p (no p2p weapons, items etc)
|
||||
*/
|
||||
public static boolean F2P_WILDY = true;
|
||||
/**
|
||||
* Our World's Number, Gets set upon launch.
|
||||
*/
|
||||
public static int WORLD_NUMBER = 0;
|
||||
/**
|
||||
* Message of the Day (Seen as you log in)
|
||||
*/
|
||||
public static String MOTD = "";
|
||||
/**
|
||||
* Exp Rate multiplier per kill.
|
||||
*/
|
||||
public static final double EXP_RATE = 4.0;
|
||||
/**
|
||||
* Subscribed Exp Rate multiplier per kill.
|
||||
*/
|
||||
public static final double SUB_EXP_RATE = 4.0;
|
||||
/**
|
||||
* The amount of players on this server.
|
||||
*/
|
||||
public static int ONLINE_COUNT = Instance.getWorld().getPlayers()
|
||||
.size();
|
||||
/**
|
||||
* Each time a connection is made to the server, this is incremented.
|
||||
*/
|
||||
@ -83,13 +53,6 @@ public class Constants {
|
||||
public static final int[] NPCS_THAT_DONT_RETREAT = { 65, 102, 100, 127,
|
||||
258 };
|
||||
|
||||
public static final String[] PMODS = { "There are currently no PMODS" };
|
||||
public static final String[] MODS = { "Mod Jake", "Mod Robert",
|
||||
"Mod x0x0", "Mod Andrew", "Mod Trauma", "Mod Andrew",
|
||||
"Mod Miku" };
|
||||
|
||||
public static final String[] ADMINS = { "Mod Necroth", "KO9" };
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -113,7 +76,7 @@ public class Constants {
|
||||
* Channel for the IRC bot to join
|
||||
*/
|
||||
public static final String NICK = "msc_"
|
||||
+ (GameServer.MEMBER_WORLD ? "P2P" : "F2P") + "_"
|
||||
+ (Config.members ? "P2P" : "F2P") + "_"
|
||||
+ Formulae.Rand(0, 900);
|
||||
/**
|
||||
* the login/full name thing IRC wants. [NOT NICKNAME]
|
||||
|
@ -44,23 +44,20 @@ public class Server {
|
||||
|
||||
if (args[2] != null && args[2].equalsIgnoreCase("no"))
|
||||
Constants.IRC.USE_IRC = false;
|
||||
|
||||
Constants.GameServer.MEMBER_WORLD = args[1].equalsIgnoreCase("p2p");
|
||||
Constants.GameServer.MOTD = "@yel@Welcome to @whi@" + Constants.GameServer.SERVER_NAME + "@yel@ - World @whi@" + (Constants.GameServer.WORLD_NUMBER == 0 ? 2 : Constants.GameServer.WORLD_NUMBER) + " (" + (Constants.GameServer.MEMBER_WORLD ? "P2P" : "F2P") + ")";
|
||||
|
||||
|
||||
world = Instance.getWorld();
|
||||
world.wl.loadObjects();
|
||||
|
||||
Config.initConfig(configFile);
|
||||
World.initilizeDB();
|
||||
|
||||
Logger.println(Constants.GameServer.SERVER_NAME + " [" + (Constants.GameServer.MEMBER_WORLD ? "P2P" : "F2P") + "] " + "Server starting up...");
|
||||
Logger.println(Config.SERVER_NAME + " [" + (Config.members ? "P2P" : "F2P") + "] " + "Server starting up...");
|
||||
|
||||
new Server();
|
||||
}
|
||||
|
||||
public static boolean isMembers() {
|
||||
return Constants.GameServer.MEMBER_WORLD;
|
||||
return Config.members;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -182,7 +179,7 @@ public class Server {
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public void kill() {
|
||||
Logger.print(Constants.GameServer.SERVER_NAME + " shutting down...");
|
||||
Logger.print(Config.SERVER_NAME + " shutting down...");
|
||||
running = false;
|
||||
engine.emptyWorld();
|
||||
connector.kill();
|
||||
|
@ -2,7 +2,7 @@ package org.moparscape.msc.gs.event;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.moparscape.msc.config.Constants;
|
||||
import org.moparscape.msc.config.Config;
|
||||
import org.moparscape.msc.config.Formulae;
|
||||
import org.moparscape.msc.gs.Instance;
|
||||
import org.moparscape.msc.gs.core.GameEngine;
|
||||
@ -96,7 +96,7 @@ public class RangeEvent extends DelayedEvent {
|
||||
continue;
|
||||
}
|
||||
arrowID = aID;
|
||||
if(owner.getLocation().inWilderness() && Constants.GameServer.F2P_WILDY) {
|
||||
if(owner.getLocation().inWilderness() && Config.f2pWildy) {
|
||||
if(arrowID != 11 && arrowID != 190) {
|
||||
owner.getActionSender().sendMessage("You may not use P2P (Member Item) Arrows in the F2P Wilderness");
|
||||
owner.resetRange();
|
||||
|
@ -8,7 +8,6 @@ import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
import org.moparscape.msc.config.Config;
|
||||
import org.moparscape.msc.config.Constants;
|
||||
import org.moparscape.msc.config.Formulae;
|
||||
import org.moparscape.msc.gs.Instance;
|
||||
import org.moparscape.msc.gs.external.EntityHandler;
|
||||
@ -142,14 +141,14 @@ public class WorldLoader {
|
||||
public void loadObjects() {
|
||||
World world = Instance.getWorld();
|
||||
for (GameObjectLoc gameObject : (List<GameObjectLoc>) PersistenceManager.load("locs/GameObjectLoc.xml.gz")) {
|
||||
if(Constants.GameServer.F2P_WILDY && Formulae.isP2P(true, gameObject))
|
||||
if(Config.f2pWildy && Formulae.isP2P(true, gameObject))
|
||||
continue;
|
||||
if (Formulae.isP2P(gameObject) && !World.isMembers())
|
||||
continue;
|
||||
world.registerGameObject(new GameObject(gameObject));
|
||||
}
|
||||
for (ItemLoc item : (List<ItemLoc>) PersistenceManager.load("locs/ItemLoc.xml.gz")) {
|
||||
if(Constants.GameServer.F2P_WILDY && Formulae.isP2P(true, item))
|
||||
if(Config.f2pWildy && Formulae.isP2P(true, item))
|
||||
continue;
|
||||
if (Formulae.isP2P(item) && !World.isMembers())
|
||||
continue;
|
||||
@ -157,7 +156,7 @@ public class WorldLoader {
|
||||
}// ember
|
||||
|
||||
for (NPCLoc npc : (List<NPCLoc>) PersistenceManager.load("locs/NpcLoc.xml.gz")) {
|
||||
if(Constants.GameServer.F2P_WILDY && Formulae.isP2P(true, npc))
|
||||
if(Config.f2pWildy && Formulae.isP2P(true, npc))
|
||||
continue;
|
||||
if (Formulae.isP2P(npc) && !World.isMembers())
|
||||
continue;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.moparscape.msc.gs.model;
|
||||
|
||||
import org.moparscape.msc.config.Config;
|
||||
import org.moparscape.msc.config.Constants;
|
||||
import org.moparscape.msc.config.Formulae;
|
||||
import org.moparscape.msc.gs.Instance;
|
||||
@ -185,7 +186,7 @@ public class Entity {
|
||||
}
|
||||
|
||||
public void setLocation(Point p) {
|
||||
if(this instanceof Player && location != null && Constants.GameServer.F2P_WILDY) {
|
||||
if(this instanceof Player && location != null && Config.f2pWildy) {
|
||||
Player pl = (Player)this;
|
||||
if(pl != null && getX() > 0 && getY() > 0) {
|
||||
if(!Point.inWilderness(getX(), getY()) && Point.inWilderness(p.getX(), p.getY())) {
|
||||
|
@ -3,6 +3,7 @@ package org.moparscape.msc.gs.model;
|
||||
import java.util.ArrayList;
|
||||
import java.util.ConcurrentModificationException;
|
||||
|
||||
import org.moparscape.msc.config.Config;
|
||||
import org.moparscape.msc.config.Constants;
|
||||
import org.moparscape.msc.config.Formulae;
|
||||
import org.moparscape.msc.gs.Instance;
|
||||
@ -423,7 +424,7 @@ public class Npc extends Mob {
|
||||
int hit = DataConversions.random(0, total);
|
||||
total = 0;
|
||||
if (!this.getDef().name.equalsIgnoreCase("ghost")) {
|
||||
if (this.getCombatLevel() >= 90 && Constants.GameServer.MEMBER_WORLD) {
|
||||
if (this.getCombatLevel() >= 90 && Config.members) {
|
||||
if (Formulae.Rand(0, 3000) == 500) {
|
||||
if (Formulae.Rand(0, 1) == 1) {
|
||||
world.registerItem(new Item(1276, getX(), getY(), 1, owner));
|
||||
|
@ -14,6 +14,7 @@ import java.util.TreeMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.mina.common.IoSession;
|
||||
import org.moparscape.msc.config.Config;
|
||||
import org.moparscape.msc.config.Constants;
|
||||
import org.moparscape.msc.config.Formulae;
|
||||
import org.moparscape.msc.gs.Instance;
|
||||
@ -22,7 +23,6 @@ import org.moparscape.msc.gs.builders.ls.SavePacketBuilder;
|
||||
import org.moparscape.msc.gs.connection.LSPacket;
|
||||
import org.moparscape.msc.gs.connection.RSCPacket;
|
||||
import org.moparscape.msc.gs.core.GameEngine;
|
||||
import org.moparscape.msc.gs.db.DBConnection;
|
||||
import org.moparscape.msc.gs.event.DelayedEvent;
|
||||
import org.moparscape.msc.gs.event.MiniEvent;
|
||||
import org.moparscape.msc.gs.event.RangeEvent;
|
||||
@ -1511,9 +1511,9 @@ public final class Player extends Mob {
|
||||
return;
|
||||
}
|
||||
|
||||
double exprate = Constants.GameServer.EXP_RATE;
|
||||
double exprate = Config.expRate;
|
||||
if (isSubscriber()) {
|
||||
exprate = Constants.GameServer.SUB_EXP_RATE;
|
||||
exprate = Config.subExpRate;
|
||||
}
|
||||
|
||||
if(getLocation().wildernessLevel() > 1) {
|
||||
@ -1741,7 +1741,7 @@ public final class Player extends Mob {
|
||||
* Restricts P2P stuff in wilderness.
|
||||
*/
|
||||
public void p2pWildy() {
|
||||
if (Constants.GameServer.F2P_WILDY) {
|
||||
if (Config.f2pWildy) {
|
||||
|
||||
boolean found = false;
|
||||
for (InvItem i : getInventory().getItems()) {
|
||||
|
@ -8,7 +8,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.moparscape.msc.config.Constants;
|
||||
import org.moparscape.msc.config.Config;
|
||||
import org.moparscape.msc.gs.Server;
|
||||
import org.moparscape.msc.gs.core.ClientUpdater;
|
||||
import org.moparscape.msc.gs.core.DelayedEventHandler;
|
||||
@ -128,7 +128,7 @@ public final class World {
|
||||
}
|
||||
|
||||
public static boolean isMembers() {
|
||||
return Constants.GameServer.MEMBER_WORLD;
|
||||
return Config.members;
|
||||
}
|
||||
public WorldLoader wl;
|
||||
/**
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.moparscape.msc.gs.phandler;
|
||||
|
||||
import org.apache.mina.common.IoSession;
|
||||
import org.moparscape.msc.config.Config;
|
||||
import org.moparscape.msc.config.Constants;
|
||||
import org.moparscape.msc.config.Formulae;
|
||||
import org.moparscape.msc.gs.Instance;
|
||||
@ -230,7 +231,7 @@ public class PlayerLogin implements PacketHandler {
|
||||
sender.sendOnlinePlayers();
|
||||
|
||||
if(newchar)
|
||||
player.getActionSender().sendMessage("@ran@Talk to the Community Instructor for information about " + Constants.GameServer.SERVER_NAME);
|
||||
player.getActionSender().sendMessage("@ran@Talk to the Community Instructor for information about " + Config.SERVER_NAME);
|
||||
|
||||
if (player.clientWarn()) {
|
||||
player.getActionSender().sendAlert("@red@Alert! @whi@You are using an old client, please download the new client from our website. This client WILL stop working @red@soon.", false);
|
||||
|
@ -1,7 +1,7 @@
|
||||
package org.moparscape.msc.gs.phandler.client;
|
||||
|
||||
import org.apache.mina.common.IoSession;
|
||||
import org.moparscape.msc.config.Constants;
|
||||
import org.moparscape.msc.config.Config;
|
||||
import org.moparscape.msc.config.Formulae;
|
||||
import org.moparscape.msc.gs.Instance;
|
||||
import org.moparscape.msc.gs.connection.Packet;
|
||||
@ -152,7 +152,7 @@ public class AttackHandler implements PacketHandler {
|
||||
player.resetPath();
|
||||
return;
|
||||
}
|
||||
if(Constants.GameServer.F2P_WILDY && player.getLocation().inWilderness()) {
|
||||
if(Config.f2pWildy && player.getLocation().inWilderness()) {
|
||||
|
||||
for(InvItem i : player.getInventory().getItems()) {
|
||||
if(i.getID() == 638 || i.getID() == 640 || i.getID() == 642 || i.getID() == 644 || i.getID() == 646) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package org.moparscape.msc.gs.phandler.client;
|
||||
|
||||
import org.apache.mina.common.IoSession;
|
||||
import org.moparscape.msc.config.Constants;
|
||||
import org.moparscape.msc.config.Config;
|
||||
import org.moparscape.msc.gs.Instance;
|
||||
import org.moparscape.msc.gs.Server;
|
||||
import org.moparscape.msc.gs.connection.Packet;
|
||||
@ -42,7 +42,7 @@ public class InvActionHandler implements PacketHandler {
|
||||
player.setSuspiciousPlayer(true);
|
||||
return;
|
||||
}
|
||||
if(item.getDef().isMembers() && Constants.GameServer.F2P_WILDY && player.getLocation().inWilderness() && item.getID() != 814) {
|
||||
if(item.getDef().isMembers() && Config.f2pWildy && player.getLocation().inWilderness() && item.getID() != 814) {
|
||||
player.getActionSender().sendMessage("Can not use a Member item in the wilderness");
|
||||
return;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package org.moparscape.msc.gs.phandler.client;
|
||||
|
||||
import org.apache.mina.common.IoSession;
|
||||
import org.moparscape.msc.config.Constants;
|
||||
import org.moparscape.msc.config.Config;
|
||||
import org.moparscape.msc.config.Formulae;
|
||||
import org.moparscape.msc.gs.Instance;
|
||||
import org.moparscape.msc.gs.Server;
|
||||
@ -36,7 +36,7 @@ public class InvUseOnItem implements PacketHandler {
|
||||
|
||||
private boolean attachFeathers(Player player, final InvItem feathers, final InvItem item) {
|
||||
int amount = 10;
|
||||
if (!Constants.GameServer.MEMBER_WORLD) {
|
||||
if (!Config.members) {
|
||||
player.getActionSender().sendMessage("This feature is not avaliable in f2p");
|
||||
return true;
|
||||
}
|
||||
@ -89,7 +89,7 @@ public class InvUseOnItem implements PacketHandler {
|
||||
|
||||
private boolean doArrowHeads(Player player, final InvItem headlessArrows, final InvItem arrowHeads) {
|
||||
final ItemArrowHeadDef headDef = EntityHandler.getItemArrowHeadDef(arrowHeads.getID());
|
||||
if (!Constants.GameServer.MEMBER_WORLD) {
|
||||
if (!Config.members) {
|
||||
player.getActionSender().sendMessage("This feature is not avaliable in f2p");
|
||||
return true;
|
||||
}
|
||||
@ -125,7 +125,7 @@ public class InvUseOnItem implements PacketHandler {
|
||||
|
||||
private boolean doBowString(Player player, final InvItem bowString, final InvItem bow) {
|
||||
final ItemBowStringDef stringDef = EntityHandler.getItemBowStringDef(bow.getID());
|
||||
if (!Constants.GameServer.MEMBER_WORLD) {
|
||||
if (!Config.members) {
|
||||
player.getActionSender().sendMessage("This feature is not avaliable in f2p");
|
||||
return true;
|
||||
}
|
||||
@ -180,7 +180,7 @@ public class InvUseOnItem implements PacketHandler {
|
||||
if (glass.getID() != 623) {
|
||||
return false;
|
||||
}
|
||||
if (!Constants.GameServer.MEMBER_WORLD) {
|
||||
if (!Config.members) {
|
||||
player.getActionSender().sendMessage("This feature is not avaliable in f2p");
|
||||
return true;
|
||||
}
|
||||
@ -254,7 +254,7 @@ public class InvUseOnItem implements PacketHandler {
|
||||
if (herbDef == null) {
|
||||
return false;
|
||||
}
|
||||
if (!Constants.GameServer.MEMBER_WORLD) {
|
||||
if (!Config.members) {
|
||||
player.getActionSender().sendMessage("This feature is not avaliable in f2p");
|
||||
return true;
|
||||
}
|
||||
@ -277,7 +277,7 @@ public class InvUseOnItem implements PacketHandler {
|
||||
}
|
||||
|
||||
private boolean doHerbSecond(Player player, final InvItem second, final InvItem unfinished, final ItemHerbSecond def) {
|
||||
if (!Constants.GameServer.MEMBER_WORLD) {
|
||||
if (!Config.members) {
|
||||
player.getActionSender().sendMessage("This feature is not avaliable in f2p");
|
||||
return true;
|
||||
}
|
||||
@ -304,7 +304,7 @@ public class InvUseOnItem implements PacketHandler {
|
||||
private boolean doLogCut(final Player player, final InvItem knife, final InvItem log, int times) {
|
||||
final int retries = --times;
|
||||
final ItemLogCutDef cutDef = EntityHandler.getItemLogCutDef(log.getID());
|
||||
if (!Constants.GameServer.MEMBER_WORLD) {
|
||||
if (!Config.members) {
|
||||
player.getActionSender().sendMessage("This feature is not avaliable in f2p");
|
||||
return true;
|
||||
}
|
||||
@ -810,7 +810,7 @@ public class InvUseOnItem implements PacketHandler {
|
||||
|
||||
for (int i = 0; i < combinePotions.length; i++) {
|
||||
if ((item1.getID() == combinePotions[i][0] && item2.getID() == combinePotions[i][1]) || (item2.getID() == combinePotions[i][0] && item1.getID() == combinePotions[i][1])) {
|
||||
if (!Constants.GameServer.MEMBER_WORLD) {
|
||||
if (!Config.members) {
|
||||
player.getActionSender().sendMessage("This feature is not avaliable in f2p");
|
||||
return;
|
||||
}
|
||||
@ -821,7 +821,7 @@ public class InvUseOnItem implements PacketHandler {
|
||||
return;
|
||||
}
|
||||
} else if (item1.getID() == combinePotions[i][1] && item2.getID() == combinePotions[i][1]) {
|
||||
if (!Constants.GameServer.MEMBER_WORLD) {
|
||||
if (!Config.members) {
|
||||
player.getActionSender().sendMessage("This feature is not avaliable in f2p");
|
||||
return;
|
||||
}
|
||||
@ -835,7 +835,7 @@ public class InvUseOnItem implements PacketHandler {
|
||||
player.getActionSender().sendMessage("You combine the Potions");
|
||||
return;
|
||||
} else if (item1.getID() == combinePotions[i][0] && item2.getID() == combinePotions[i][0]) {
|
||||
if (!Constants.GameServer.MEMBER_WORLD) {
|
||||
if (!Config.members) {
|
||||
player.getActionSender().sendMessage("This feature is not avaliable in f2p");
|
||||
return;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package org.moparscape.msc.gs.phandler.client;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.apache.mina.common.IoSession;
|
||||
import org.moparscape.msc.config.Constants;
|
||||
import org.moparscape.msc.config.Config;
|
||||
import org.moparscape.msc.config.Formulae;
|
||||
import org.moparscape.msc.gs.Instance;
|
||||
import org.moparscape.msc.gs.Server;
|
||||
@ -127,7 +127,7 @@ public class ObjectAction implements PacketHandler {
|
||||
}
|
||||
world.addEntryToSnapshots(new Activity(owner.getUsername(), owner.getUsername() + " used an Object (" + object.getID() + ") @ " + object.getX() + ", " + object.getY()));
|
||||
owner.resetAll();
|
||||
if (object.getX() == 621 && object.getY() == 596 && Constants.GameServer.F2P_WILDY) {
|
||||
if (object.getX() == 621 && object.getY() == 596 && Config.f2pWildy) {
|
||||
owner.getActionSender().sendMessage("Currently disabled!1!");
|
||||
return;
|
||||
}
|
||||
|
@ -3,12 +3,12 @@ package org.moparscape.msc.gs.phandler.client;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.TreeMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.mina.common.IoSession;
|
||||
import org.moparscape.msc.config.Config;
|
||||
import org.moparscape.msc.config.Constants;
|
||||
import org.moparscape.msc.config.Formulae;
|
||||
import org.moparscape.msc.gs.Instance;
|
||||
@ -1037,14 +1037,14 @@ public class SpellHandler implements PacketHandler {
|
||||
|| spell.getReqLevel() == 65
|
||||
|| spell.getReqLevel() == 70
|
||||
|| spell.getReqLevel() == 75) {
|
||||
if (!Constants.GameServer.MEMBER_WORLD) {
|
||||
if (!Config.members) {
|
||||
player.getActionSender()
|
||||
.sendMessage(
|
||||
"Must be on a members server to use this");
|
||||
return;
|
||||
}
|
||||
if (player.getLocation().inWilderness()
|
||||
&& Constants.GameServer.F2P_WILDY) {
|
||||
&& Config.f2pWildy) {
|
||||
player.getActionSender()
|
||||
.sendMessage(
|
||||
"You can not cast this Members spell in F2P Wilderness");
|
||||
|
@ -4,7 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.mina.common.IoSession;
|
||||
import org.moparscape.msc.config.Constants;
|
||||
import org.moparscape.msc.config.Config;
|
||||
import org.moparscape.msc.config.Formulae;
|
||||
import org.moparscape.msc.gs.Instance;
|
||||
import org.moparscape.msc.gs.connection.Packet;
|
||||
@ -46,7 +46,7 @@ public class WieldHandler implements PacketHandler {
|
||||
player.setSuspiciousPlayer(true);
|
||||
return;
|
||||
}
|
||||
if(player.getLocation().inWilderness() && item.getDef().isMembers() && Constants.GameServer.F2P_WILDY) {
|
||||
if(player.getLocation().inWilderness() && item.getDef().isMembers() && Config.f2pWildy) {
|
||||
player.getActionSender().sendMessage("Can't wield a P2P item in wilderness");
|
||||
return;
|
||||
}
|
||||
@ -91,7 +91,7 @@ public class WieldHandler implements PacketHandler {
|
||||
player.getActionSender().sendMessage("You must have at least " + youNeed.substring(0, youNeed.length() - 2) + " to use this item.");
|
||||
return;
|
||||
}
|
||||
if (Constants.GameServer.MEMBER_WORLD) {
|
||||
if (Config.members) {
|
||||
if (item.getID() == 594) {
|
||||
int count = 0;
|
||||
for (Quest q : World.getQuestManager().getQuests()) {
|
||||
|
@ -2,7 +2,7 @@ package org.moparscape.msc.gs.plugins.ai;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.moparscape.msc.config.Constants;
|
||||
import org.moparscape.msc.config.Config;
|
||||
import org.moparscape.msc.gs.Instance;
|
||||
import org.moparscape.msc.gs.event.ObjectRemover;
|
||||
import org.moparscape.msc.gs.model.GameObject;
|
||||
@ -51,7 +51,7 @@ public class RedDragon extends NpcScript implements NpcAI {
|
||||
@Override
|
||||
public void onNpcDeath(Npc npc, Player player) {
|
||||
if(npc.getLocation().atAltar()) {
|
||||
if(Constants.GameServer.F2P_WILDY) {
|
||||
if(Config.f2pWildy) {
|
||||
switch(DataConversions.random(0, 3)) {
|
||||
case 0: {
|
||||
if(DataConversions.random(0, 2000) < 4) { // Drop d med
|
||||
|
@ -6,64 +6,73 @@ import java.util.Date;
|
||||
import org.moparscape.msc.gs.Instance;
|
||||
import org.moparscape.msc.gs.model.World;
|
||||
|
||||
|
||||
public class Logger {
|
||||
/**
|
||||
* World instance
|
||||
*/
|
||||
private static final World world = Instance.getWorld();
|
||||
/**
|
||||
* World instance
|
||||
*/
|
||||
private static final World world = Instance.getWorld();
|
||||
|
||||
/**
|
||||
* Simple date formatter to keep a date on outputs
|
||||
*/
|
||||
private static SimpleDateFormat formatter = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss");
|
||||
|
||||
public static void connection(Object o) {
|
||||
// Logging.debug(o.toString());
|
||||
}
|
||||
/**
|
||||
* Simple date formatter to keep a date on outputs
|
||||
*/
|
||||
private static SimpleDateFormat formatter = new SimpleDateFormat(
|
||||
"yyyy.MM.dd HH:mm:ss");
|
||||
|
||||
public static void error(Object o) {
|
||||
if (o instanceof Exception) {
|
||||
Exception e = (Exception) o;
|
||||
e.printStackTrace();
|
||||
if (world == null || !Instance.getServer().isInitialized()) {
|
||||
System.exit(1);
|
||||
} else {
|
||||
Instance.getServer().kill();
|
||||
}
|
||||
return;
|
||||
public static void connection(Object o) {
|
||||
// Logging.debug(o.toString());
|
||||
}
|
||||
if (o.toString() != null)
|
||||
Instance.getServer().getLoginConnector().getActionSender().logAction(o.toString(), 2);
|
||||
}
|
||||
|
||||
public static void event(Object o) {
|
||||
Instance.getServer().getLoginConnector().getActionSender().logAction(o.toString(), 1);
|
||||
}
|
||||
public static void error(Object o) {
|
||||
if (o instanceof Exception) {
|
||||
Exception e = (Exception) o;
|
||||
e.printStackTrace();
|
||||
if (world == null || !Instance.getServer().isInitialized()) {
|
||||
System.exit(1);
|
||||
} else {
|
||||
Instance.getServer().kill();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public static void mod(Object o) {
|
||||
Instance.getServer().getLoginConnector().getActionSender().logAction(o.toString(), 3);
|
||||
}
|
||||
/**
|
||||
* Sends s to loginserver and prints to stdout
|
||||
* @param s
|
||||
*/
|
||||
public static void systemerr(String s) {
|
||||
Instance.getServer().getLoginConnector().getActionSender().logAction(s, 4);
|
||||
print(s);
|
||||
}
|
||||
/**
|
||||
* Prints to console with timestamp
|
||||
* @param o Object to print
|
||||
*/
|
||||
public static void print(Object o) {
|
||||
System.out.print(formatter.format(new Date()) + " " + o.toString());
|
||||
}
|
||||
/**
|
||||
* Prints to console with timestamp and newline
|
||||
* @param o Object to print
|
||||
*/
|
||||
public static void println(Object o) {
|
||||
System.out.println(formatter.format(new Date()) + " " + o.toString());
|
||||
}
|
||||
public static void event(Object o) {
|
||||
Instance.getServer().getLoginConnector().getActionSender()
|
||||
.logAction(o.toString(), 1);
|
||||
}
|
||||
|
||||
public static void mod(Object o) {
|
||||
Instance.getServer().getLoginConnector().getActionSender()
|
||||
.logAction(o.toString(), 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends s to loginserver and prints to stdout
|
||||
*
|
||||
* @param s
|
||||
*/
|
||||
public static void systemerr(String s) {
|
||||
Instance.getServer().getLoginConnector().getActionSender()
|
||||
.logAction(s, 4);
|
||||
print(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints to console with timestamp
|
||||
*
|
||||
* @param o
|
||||
* Object to print
|
||||
*/
|
||||
public static void print(Object o) {
|
||||
System.out.print(formatter.format(new Date()) + " " + o.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints to console with timestamp and newline
|
||||
*
|
||||
* @param o
|
||||
* Object to print
|
||||
*/
|
||||
public static void println(Object o) {
|
||||
System.out.println(formatter.format(new Date()) + " " + o.toString());
|
||||
}
|
||||
}
|
||||
|
@ -15,4 +15,14 @@
|
||||
<entry key="mysqlpass"></entry>
|
||||
<entry key="mysqlhost">localhost</entry>
|
||||
<entry key="mysqldb">moparclassic</entry>
|
||||
|
||||
<entry key="members">false</entry>
|
||||
<entry key="f2pwildy">true</entry>
|
||||
<entry key="expRate">4.0</entry>
|
||||
<entry key="subExpRate">4.0</entry>
|
||||
|
||||
<!-- Separate names by commas -->
|
||||
<entry key="pmods">None</entry>
|
||||
<entry key="mods">None</entry>
|
||||
<entry key="admins">None</entry>
|
||||
</properties>
|
||||
|
@ -10,5 +10,5 @@
|
||||
<entry key="lsport">34526</entry>
|
||||
<entry key="queryip">localhost</entry>
|
||||
<entry key="queryport">8186</entry>
|
||||
<entry key="authURL">https://www.moparscape.org/auth.php?field=rscnam</entry>
|
||||
<entry key="authURL">http://localhost/auth.php</entry>
|
||||
</properties>
|
||||
|
Loading…
Reference in New Issue
Block a user