Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.jubaroo.mods.requiem;
- import com.wurmonline.server.NoSuchPlayerException;
- import com.wurmonline.server.Players;
- import com.wurmonline.server.creatures.Creature;
- import com.wurmonline.server.items.Item;
- import com.wurmonline.server.players.PlayerInfoFactory;
- import org.jubaroo.mods.requiem.creatures.MethodsBestiary;
- import org.jubaroo.mods.requiem.items.RequiemItemIds;
- import org.jubaroo.mods.requiem.misc.MiscChanges;
- import java.io.IOException;
- import java.util.concurrent.TimeUnit;
- import java.util.logging.Level;
- public class RequiemLogging {
- public static void logException(String msg, Throwable e) {
- if (Requiem.logger != null)
- Requiem.logger.log(Level.SEVERE, msg, e);
- }
- public static void logWarning(String msg) {
- if (Requiem.logger != null)
- Requiem.logger.log(Level.WARNING, msg);
- }
- public static void logInfo(String msg) {
- if (Requiem.logger != null)
- Requiem.logger.log(Level.INFO, msg);
- }
- public static void debug(String msg) {
- if (Constants.debug) {
- Requiem.logger.info(msg);
- }
- }
- public static void RequiemLoggingMessages() {
- // ========================= Logger Messages ==============================
- // ============================ Actions ================================
- if (Constants.addGmProtect) {
- logInfo("Add GM Protect Action: Enabled");
- } else {
- logInfo("Add GM Protect Action: Disabled");
- }
- if (Constants.addGmUnprotect) {
- logInfo("Add GM Unprotect Action: Enabled");
- } else {
- logInfo("Add GM Unprotect Action: Disabled");
- }
- if (Constants.addSpawnGuard) {
- logInfo("Add Spawn Guard Action: Enabled");
- } else {
- logInfo("Add Spawn Guard Action: Disabled");
- }
- if (Constants.searchDens) {
- logInfo("Searching Dens/Lairs Action: Enabled");
- } else {
- logInfo("Searching Dens/Lairs Action: Disabled");
- }
- if (Constants.addLabyrinth) {
- logInfo("Add Labyrinth Action: Enabled");
- } else {
- logInfo("Add Labyrinth Action: Disabled");
- }
- if (Constants.terrainSmoothing) {
- logInfo("Automatic Terrain Smoothing Action: Enabled");
- } else {
- logInfo("Automatic Terrain Smoothing Action: Disabled");
- }
- // ========================== GM Changes ===========================
- if (Constants.gmFullFavor) {
- logInfo("GM Full Favor: Enabled");
- } else {
- logInfo("GM Full Favor: Disabled");
- }
- if (Constants.gmFullStamina) {
- logInfo("GM Full Stamina: Enabled");
- } else {
- logInfo("GM Full Stamina: Disabled");
- }
- if (Constants.addCommands) {
- logInfo("Add Commands: Enabled");
- } else {
- logInfo("Add Commands: Disabled");
- }
- // ========================== Items ===========================
- if (Constants.itemHolyBook) {
- logInfo("Holy Book: Enabled");
- } else {
- logInfo("Holy Book: Disabled");
- }
- logInfo("Holy Book ID: " + RequiemItemIds.HOLY_BOOK_ID);
- if (Constants.itemNymphPortal) {
- logInfo("NymphPortal: Enabled");
- } else {
- logInfo("NymphPortal: Disabled");
- }
- logInfo("Nymph Portal ID: " + RequiemItemIds.PORTAL_NYMPH_ID);
- logInfo("Nymph Portal Home ID: " + RequiemItemIds.PORTAL_HOME_NYMPH_ID);
- if (Constants.itemDemonPortal) {
- logInfo("DemonPortal: Enabled");
- } else {
- logInfo("DemonPortal: Disabled");
- }
- logInfo("Demon Portal ID: " + RequiemItemIds.PORTAL_DEMON_ID);
- logInfo("Demon Portal Home ID: " + RequiemItemIds.PORTAL_HOME_DEMON_ID);
- if (Constants.enableDepots) {
- logInfo("Depots: Enabled");
- } else {
- logInfo("Depots: Disabled");
- }
- logInfo("Elemental Crystal Creation Damage: " + Constants.itemCrystalCreationDamage);
- // ========================== Creatures ===========================
- if (Constants.setUnicornIsHorse) {
- logInfo("set Unicorn Is Horse: Enabled");
- } else {
- logInfo("set Unicorn Is Horse: Disabled");
- }
- if (Constants.animals) {
- logInfo("Animals: Enabled");
- } else {
- logInfo("Animals: Disabled");
- }
- if (Constants.customMounts) {
- logInfo("Custom Mounts: Enabled");
- } else {
- logInfo("Custom Mounts: Disabled");
- }
- if (Constants.farmAnimals) {
- logInfo("Farm Animals: Enabled");
- } else {
- logInfo("Farm Animals: Disabled");
- }
- //if (Misc.isRequiemChristmasStart() | Misc.isRequiemChristmasEnd()()) {
- // Requiem.debug("Christmas Mobs And Loot: Enabled");
- //} else {
- // Requiem.debug("Christmas Mobs And Loot: Disabled");
- //}
- //if (Misc.isRequiemHalloween()) {
- // Requiem.debug("Halloween Mobs And Loot: Enabled");
- //} else {
- // Requiem.debug("Halloween Mobs And Loot: Disabled");
- //}
- if (Constants.milkWhales) {
- logInfo("Domesticate Whales For Milking: Enabled");
- } else {
- logInfo("Domesticate Whales For Milking: Disabled");
- }
- if (Constants.monsters) {
- logInfo("Monsters: Enabled");
- } else {
- logInfo("Monsters: Disabled");
- }
- if (Constants.npc) {
- logInfo("NPCs: Enabled");
- } else {
- logInfo("NPCs: Disabled");
- }
- if (Constants.titans) {
- logInfo("Titans: Enabled");
- } else {
- logInfo("Titans: Disabled");
- }
- if (Constants.uniques) {
- logInfo("Uniques: Enabled");
- } else {
- logInfo("Uniques: Disabled");
- }
- if (Constants.undead) {
- logInfo("Undead: Enabled");
- } else {
- logInfo("Undead: Disabled");
- }
- if (Constants.wyverns) {
- logInfo("Wyverns: Enabled");
- } else {
- logInfo("Wyverns: Disabled");
- }
- // ========================== Halloween ===========================
- //if (Constants.halloweenMobs) {
- // Requiem.debug("Halloween Mobs: Enabled");
- //} else {
- // Requiem.debug("Halloween Mobs: Disabled");
- //}
- // ========================== Christmas ===========================
- if (Constants.christmasMobs) {
- logInfo("Christmas Mobs: Enabled");
- } else {
- logInfo("Christmas Mobs: Disabled");
- }
- // ========================== Spells ===========================
- logInfo("No Cooldown On These Spells: " + Constants.noCooldownSpells);
- // ========================== Other ===========================
- if (Constants.stfuNpcs) {
- logInfo("Stfu Npcs: Enabled");
- } else {
- logInfo("Stfu Npcs: Disabled");
- }
- if (Constants.loadFullContainers) {
- logInfo("Load Full Containers: Enabled");
- } else {
- logInfo("Load Full Containers: Disabled");
- }
- if (Constants.noMineDrift) {
- logInfo("No Mine Drift: Enabled");
- } else {
- logInfo("No Mine Drift: Disabled");
- }
- if (Constants.lampsAutoLight) {
- logInfo("Lamps Auto Light: Enabled");
- } else {
- logInfo("Lamps Auto Light: Disabled");
- }
- if (Constants.allowTentsOnDeed) {
- logInfo("Allow Tents On Deed: Enabled");
- } else {
- logInfo("Allow Tents On Deed: Disabled");
- }
- if (Constants.allSurfaceMine) {
- logInfo("All Surface Mine: Enabled");
- } else {
- logInfo("All Surface Mine: Disabled");
- }
- if (Constants.hidePlayerGodInscriptions) {
- logInfo("Hide Player God Inscriptions: Enabled");
- } else {
- logInfo("Hide Player God Inscriptions: Disabled");
- }
- // ========================== Mission Items ===========================
- if (Constants.addMissionItems) {
- logInfo("Add Mission Items: Enabled");
- } else {
- logInfo("Add Mission Items: Disabled");
- }
- if (Constants.coins) {
- logInfo("Coins: Enabled");
- } else {
- logInfo("Coins: Disabled");
- }
- if (Constants.riftItems) {
- logInfo("Rift Items: Enabled");
- } else {
- logInfo("Rift Items: Disabled");
- }
- if (Constants.miscItems) {
- logInfo("Misc Items: Enabled");
- } else {
- logInfo("Misc Items: Disabled");
- }
- if (Constants.metalLumps) {
- logInfo("Metal Lumps: Enabled");
- } else {
- logInfo("Metal Lumps: Disabled");
- }
- if (Constants.metalOres) {
- logInfo("Metal Ores: Enabled");
- } else {
- logInfo("Metal Ores: Disabled");
- }
- if (Constants.gems) {
- logInfo("Gems: Enabled");
- } else {
- logInfo("Gems: Disabled");
- }
- if (Constants.potionsSalvesOils) {
- logInfo("Potions, Salves, And Oils: Enabled");
- } else {
- logInfo("Potions, Salves, And Oils: Disabled");
- }
- if (Constants.mineDoors) {
- logInfo("Mine Doors: Enabled");
- } else {
- logInfo("Mine Doors: Disabled");
- }
- if (Constants.mirrors) {
- logInfo("Mirrors: Enabled");
- } else {
- logInfo("Mirrors: Disabled");
- }
- if (Constants.masks) {
- logInfo("Masks: Enabled");
- } else {
- logInfo("Masks: Disabled");
- }
- if (Constants.magicItems) {
- logInfo("Magic Items: Enabled");
- } else {
- logInfo("Magic Items: Disabled");
- }
- if (Constants.wands) {
- logInfo("Wands: Enabled");
- } else {
- logInfo("Wands: Disabled");
- }
- // ====================== Athanor Mechanism =======================
- logInfo("delayFogGoblins: " + Constants.delayFogGoblins);
- logInfo("delayTradeTents: " + Constants.delayTradeTents);
- logInfo("delayResourcePoints: " + Constants.delayResourcePoints);
- logInfo("delayLootCarpets: " + Constants.delayLootCarpets);
- logInfo("delayMobSpawners: " + Constants.delayMobSpawners);
- logInfo("delayAthanorMechanism: " + Constants.delayAthanorMechanism);
- // ========================== debugging ===========================
- if (Constants.executionCostLogging) {
- logInfo("Execution Cost Logging: Enabled");
- } else {
- logInfo("Execution Cost Logging: Disabled");
- }
- if (Constants.debug) {
- logInfo("Debug: Enabled");
- } else {
- logInfo("Debug: Disabled");
- }
- if (Constants.creatureCreateLogging) {
- logInfo("New Creature Logging: Enabled");
- } else {
- logInfo("New Creature Logging: Disabled");
- }
- if (Constants.creatureDeathLogging) {
- logInfo("Creature Death Logging: Enabled");
- } else {
- logInfo("Creature Death Logging: Disabled");
- }
- if (Constants.itemCreateLogging) {
- logInfo("Item Creation Logging: Enabled");
- } else {
- logInfo("Item Creation Logging: Disabled");
- }
- // ========================== disable modules ===========================
- if (Constants.disableEntireMod) {
- logInfo("Requiem Module: Disabled");
- } else {
- logInfo("Requiem Module: Enabled");
- }
- if (Constants.disableCreatureLoot) {
- logInfo("Creature Loot Module: Disabled");
- } else {
- logInfo("Creature Loot Module: Enabled");
- }
- if (Constants.disableCreatureMods) {
- logInfo("Creature Module: Disabled");
- } else {
- logInfo("Creature Module: Enabled");
- }
- if (Constants.disableItemMods) {
- logInfo("Item Module: Disabled");
- } else {
- logInfo("Item Module: Enabled");
- }
- if (Constants.disableVehicleMods) {
- logInfo("Vehicle Module: Disabled");
- } else {
- logInfo("Vehicle Module: Enabled");
- }
- if (Constants.disableBytcodeMods) {
- logInfo("Bytecode Module: Disabled");
- } else {
- logInfo("Bytecode Module: Enabled");
- }
- if (Constants.disableMiscMods) {
- logInfo("Misc Module: Disabled");
- } else {
- logInfo("Misc Module: Enabled");
- }
- logInfo(String.format("Newly created mailboxes will%s get %f power Courier enchants.", (!Constants.mailboxEnableEnchant ? " not" : ""), Constants.mailboxEnchantPower));
- }
- public static void CreatureSpawnLogging(Creature creature) {
- // make a small delay to logging so as to wait until the creature is fully initialized to get all data from it?
- int templateId = creature.getTemplate().getTemplateId();
- //Item[] allItems;
- //Item[] inventoryItems = allItems = creature.getInventory().getAllItems(true);
- //for (Item lInventoryItem : allItems) {
- // creature.getCommunicator().sendNormalServerMessage(lInventoryItem.getName());
- //}
- if (templateId != 0) {
- try {
- TimeUnit.SECONDS.sleep(1);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- logInfo("----------> Creature Spawned <----------");
- logInfo("Name: " + creature.getNameWithoutPrefixes());
- logInfo("TemplateId: " + templateId);
- logInfo("WID: " + creature.getWurmId());
- logInfo("Sex: " + MiscChanges.getSexString(creature.getStatus().getSex()));
- logInfo("Condition: " + MethodsBestiary.getTypeString(creature));
- logInfo(String.format("Location: X= %s Y= %s", creature.getTileX(), creature.getTileY()));
- if (creature.getCurrentVillage() != null) {
- logInfo("Deed name: " + creature.getCurrentVillage().getName());
- }
- logInfo("Zone Id: " + creature.getStatus().getZoneId());
- logInfo("Surface?: " + creature.isOnSurface());
- logInfo("Age: " + creature.getStatus().age);
- logInfo("Age string: " + creature.getStatus().getAgeString());
- if (creature.numattackers != 0) {
- logInfo("Number of attackers: " + creature.numattackers);
- }
- logInfo("Is a player?: " + creature.isPlayer());
- logInfo("Hunger: " + creature.getStatus().getHunger());
- logInfo("Thirst: " + creature.getStatus().getThirst());
- logInfo("Fat: " + creature.getStatus().getFats());
- //logInfo(String.format("Inventory: ", (Object[]) inventoryItems));
- }
- logInfo("----------> Creature Spawned <----------");
- }
- public static void CreatureDeathLogging(Creature creature) {
- try {
- //Item[] allItems;
- //Item[] inventoryItems = allItems = creature.getInventory().getAllItems(true);
- //for (Item lInventoryItem : allItems) {
- // creature.getCommunicator().sendNormalServerMessage(lInventoryItem.getName());
- //}
- int templateId = creature.getTemplate().getTemplateId();
- if (templateId != 0) {
- logInfo("----------> Creature Death <----------");
- logInfo("Name: " + creature.getNameWithoutPrefixes());
- logInfo("TemplateId: " + templateId);
- logInfo("WID: " + creature.getWurmId());
- logInfo("Sex: " + MiscChanges.getSexString(creature.getStatus().getSex()));
- logInfo("Condition: " + MethodsBestiary.getTypeString(creature));
- logInfo(String.format("Location: X= %s Y= %s", creature.getTileX(), creature.getTileY()));
- if (creature.getCurrentVillage() != null) {
- logInfo("Deed name: " + creature.getCurrentVillage().getName());
- }
- logInfo("Zone Id: " + creature.getStatus().getZoneId());
- logInfo("Surface?: " + creature.isOnSurface());
- //Requiem.debug("Creature was killed by: " + attackers);
- logInfo("Age: " + creature.getStatus().age);
- logInfo("Age string: " + creature.getStatus().getAgeString());
- logInfo("Number of attackers: " + creature.numattackers);
- logInfo("Is a player?: " + creature.isPlayer());
- logInfo("Hunger: " + creature.getStatus().getHunger());
- logInfo("Thirst: " + creature.getStatus().getThirst());
- if (creature.getNumberOfFollowers() != 0) {
- logInfo(String.format("Followers: %s", creature.getNumberOfFollowers()));
- }
- if (creature.getLeader() != null) {
- logInfo(String.format("Leader: %s", creature.getLeader().getNameWithoutPrefixes()));
- }
- if (creature.getDominator() != null) {
- logInfo("Dominated by: " + Players.getInstance().getNameFor(creature.dominator));
- }
- if (creature.getHitched() != null) {
- RequiemLogging.logInfo("Hitched Vehicle name: " + creature.getHitched().name);
- }
- //logInfo(String.format("Inventory: ", (Object[]) inventoryItems));
- logInfo("----------> Creature Death <----------");
- }
- } catch (NoSuchPlayerException | IOException e) {
- e.printStackTrace();
- }
- }
- public static void ItemCreationLogging(Item item) {
- // make a small delay to logging so as to wait until the item is fully initialized to get all data from it?
- int templateId = item.getTemplate().getTemplateId();
- if (templateId != 0) {
- logInfo("----------> Item Created <----------");
- logInfo(String.format("Name: %s", item.getName()));
- logInfo(String.format("TemplateId: %s", templateId));
- logInfo(String.format("WID: %s", item.getWurmId()));
- if (item.getParentOrNull() != null) {
- logInfo(String.format("Parent Name: %s", item.getParentOrNull().getName()));
- }
- if (item.getTopParentOrNull() != null) {
- logInfo(String.format("Top Parent Name: %s", item.getTopParentOrNull().getName()));
- }
- if (item.isHollow()) {
- logInfo(String.format("Container Size: X= %s, Y= %s, Z= %s", item.getContainerSizeX(), item.getContainerSizeY(), item.getContainerSizeZ()));
- } else if (item.isBulkContainer()) {
- logInfo(String.format("Container Volume: %s", item.getContainerVolume()));
- }
- logInfo(String.format("Created by: %s", PlayerInfoFactory.getPlayerName(item.lastOwner)));
- logInfo(String.format("Coordinates: X= %s Y= %s", item.getTileX(), item.getTileY()));
- logInfo(String.format("Raw Coordinates: X= %s Y= %s", item.getPosXRaw(), item.getPosYRaw()));
- logInfo(String.format("Quality: %s", item.getCurrentQualityLevel()));
- logInfo(String.format("Damage: %s", item.getDamage()));
- logInfo(String.format("Weight: %s grams", (int) item.getWeightGrams()));
- logInfo(String.format("Rarity: %s", MiscChanges.getRarityString(item.getRarity())));
- logInfo(String.format("Data1: %s", item.getData1()));
- logInfo(String.format("Data2: %s", item.getData2()));
- logInfo(String.format("AuxData: %s", item.getAuxData()));
- logInfo(String.format("Extra1: %s", item.getExtra1()));
- logInfo(String.format("Extra2: %s", item.getExtra2()));
- logInfo("----------> Item Created <----------");
- }
- }
- public static void ItemRemovalLogging(Item item) {
- int templateId = item.getTemplate().getTemplateId();
- if (templateId != 0) {
- logInfo("----------> Item Destroyed <----------");
- logInfo(String.format("Name: %s", item.getName()));
- logInfo(String.format("TemplateId: %s", templateId));
- logInfo(String.format("WID: %s", item.getWurmId()));
- if (item.getParentOrNull() != null) {
- logInfo(String.format("Parent Name: %s", item.getParentOrNull().getName()));
- }
- if (item.getTopParentOrNull() != null) {
- logInfo(String.format("Top Parent Name: %s", item.getTopParentOrNull().getName()));
- }
- if (item.isHollow()) {
- logInfo(String.format("Container Size: X= %s, Y= %s, Z= %s", item.getContainerSizeX(), item.getContainerSizeY(), item.getContainerSizeZ()));
- } else if (item.isBulkContainer()) {
- logInfo(String.format("Container Volume: %s", item.getContainerVolume()));
- }
- logInfo(String.format("Created by: %s [%s]", PlayerInfoFactory.getPlayerName(item.lastOwner), item.getOwnerId()));
- logInfo(String.format("Coordinates: X= %s Y= %s", item.getTileX(), item.getTileY()));
- logInfo(String.format("Quality: %s", item.getCurrentQualityLevel()));
- logInfo(String.format("Damage: %s", item.getDamage()));
- logInfo(String.format("Weight: %s grams", (int) item.getWeightGrams()));
- logInfo(String.format("Rarity: %s", MiscChanges.getRarityString(item.getRarity())));
- logInfo(String.format("Data1: %s", item.getData1()));
- logInfo(String.format("Data2: %s", item.getData2()));
- logInfo(String.format("AuxData: %s", item.getAuxData()));
- logInfo(String.format("Extra1: %s", item.getExtra1()));
- logInfo(String.format("Extra2: %s", item.getExtra2()));
- logInfo("----------> Item Destroyed <----------");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement