CMObject, Tickable, CMLibrary, FactionManager, java.lang.Cloneable, java.lang.Comparable<CMObject>public class Factions extends StdLibrary implements FactionManager
FactionManager.FAbilityMaskType| Modifier and Type | Field | Description |
|---|---|---|
protected java.util.List<java.lang.String> |
autoReactions |
|
SHashtable<java.lang.String,Faction> |
factionMap |
|
java.util.Map<Faction.Align,java.util.List<Faction.FRange>> |
hashedFactionAligns |
|
SHashtable<java.lang.String,Faction.FRange> |
hashedFactionRanges |
idConverterisDebugging, name, serviceClient, tickStatusSTATUS_AFFECT, STATUS_ALIVE, STATUS_BEHAVIOR, STATUS_CLASS, STATUS_DEAD, STATUS_END, STATUS_FIGHT, STATUS_MISC, STATUS_MISC2, STATUS_MISC3, STATUS_MISC4, STATUS_MISC5, STATUS_MISC6, STATUS_MISC7, STATUS_NOT, STATUS_OTHER, STATUS_RACE, STATUS_REBIRTH, STATUS_SCRIPT, STATUS_START, STATUS_WEATHER, TICKID_AREA, TICKID_BALLISTICK, TICKID_CLAN, TICKID_CLANITEM, TICKID_DEADBODY_DECAY, TICKID_ELECTRONICS, TICKID_EMAIL, TICKID_EVENT, TICKID_EXIT_BEHAVIOR, TICKID_EXIT_REOPEN, TICKID_ITEM_BEHAVIOR, TICKID_ITEM_BOUNCEBACK, TICKID_LIGHT_FLICKERS, TICKID_LIVEAUCTION, TICKID_LONGERMASK, TICKID_MISCELLANEOUS, TICKID_MOB, TICKID_PROPERTY_SPECIAL, TICKID_QUEST, TICKID_READYTOSTOP, TICKID_ROOM_BEHAVIOR, TICKID_ROOM_ITEM_REJUV, TICKID_SHORTERMASK, TICKID_SOLITARYMASK, TICKID_SPECIALCOMBAT, TICKID_SPECIALMANEUVER, TICKID_SPELL_AFFECT, TICKID_SUPPORT, TICKID_TIMEAUCTION, TICKID_TRAP_DESTRUCTION, TICKID_TRAP_RESET| Constructor | Description |
|---|---|
Factions() |
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
addFaction(Faction F) |
Adds a new faction to the memory cache, or modify one
with the same id.
|
protected void |
addOutsidersAndTimers(Faction F,
java.util.List<Faction.FactionChangeEvent> outSiders,
java.util.List<Faction.FactionChangeEvent> timers) |
|
void |
clearFactions() |
Clears out all cached factions, which
is part of the shutdown process
|
java.util.Enumeration<Faction> |
factions() |
Returns the enumeration of all the factions
|
FactionManager.FAbilityMaskType |
getAbilityFlagType(java.lang.String strflag) |
Returns what type of ability mask is represented by the string,
as one of the FAbilityMaskType enums, which includes things like
the Ability Code, Domain, Ability Flag (usually prefixed with "!"),
or an Ability ID
|
Faction.Align |
getAlignEnum(java.lang.String str) |
Returns the Align enum that matches the given string,
or INDIFF if not found.
|
int |
getAlignMedianFacValue(Faction.Align eq) |
Returns the purist alignment/inclination faction value associated with the given
Align enum.
|
java.lang.String |
getAlignmentID() |
Returns the faction ID assigned to 'alignment' (good, evil, neutral)
|
int |
getAlignPurity(int faction,
Faction.Align eq) |
Returns the percentage 0-100 of distance that the given
faction value is from the given alignment enum.
|
Faction |
getFaction(java.lang.String factionID) |
Returns the faction with the given faction id.
|
Faction |
getFactionByName(java.lang.String factionNamed) |
Returns the faction object with the given
exact case-insensitive display name.
|
Faction |
getFactionByNumber(int index) |
Returns the faction with the given enum index
number.
|
Faction |
getFactionByRangeCodeName(java.lang.String rangeCodeName) |
Returns the Faction that contains the given range code name.
|
Faction.FRange |
getFactionRangeByCodeName(java.lang.String rangeCodeName) |
Returns the faction range object whose range code matches
the given string.
|
Faction.FacTag |
getFactionTag(java.lang.String tag) |
Returns which faction tag (FacTag) enum
is represented by the given string, which is
typically a parameter from a faction definition/ini
file.
|
java.lang.String |
getInclinationID() |
Returns the faction ID assigned to 'inclination' (lawful, mod, chaotic)
|
int |
getInclinationPurity(int faction,
Faction.Align eq) |
Returns the percentage 0-100 of distance that the given
faction value is from the given alignment enum.
|
int |
getMaximum(java.lang.String factionID) |
Returns the absolute maximum possible faction
value that the faction with the given id can
be assigned.
|
int |
getMinimum(java.lang.String factionID) |
Returns the absolute minimum possible faction
value that the faction with the given id can
be assigned.
|
java.lang.String |
getName(java.lang.String factionID) |
Returns the friendly faction display name
associated with the given faction id
|
int |
getPercent(java.lang.String factionID,
int faction) |
Returns the percentage of the total faction numeric
range (0 to 100) that the given faction number
represents.
|
int |
getPercentFromAvg(java.lang.String factionID,
int faction) |
Returns the percentage of the total faction numeric
range (0 to 100) that the given faction number
represents.
|
int |
getRandom(java.lang.String factionID) |
Returns a random faction number in the range
from its minimum to maximum, given a faction
id.
|
Faction.FRange |
getRange(java.lang.String factionID,
int faction) |
Returns the faction range from the faction with the given faction
id whose range covers the given faction value.
|
double |
getRangePercent(java.lang.String factionID,
int faction) |
Returns the percentage of the total faction numeric
range (0.00 to 100.00) that the given faction number
represents.
|
java.util.Enumeration<Faction.FRange> |
getRanges(java.lang.String factionID) |
Returns an enumerator of all faction range objects in the
faction with the given id.
|
Faction |
getSpecialAreaFaction(Area A) |
If area reactions are enabled, and the given area has one of them, then this
will return the areas faction.
|
Faction[] |
getSpecialFactions(MOB mob,
Room R) |
If reaction factions are enabled, and the given location has one of them,
then this will return the applicable faction.
|
int |
getTickStatus() |
A coded status for this object during the period where
its tick method is being called.
|
int |
getTotal(java.lang.String factionID) |
Gets the absolute number of points in this faction,
essentially the max - min.
|
java.lang.String |
ID() |
The CoffeeMud Java Class ID shared by all instances of
this object.
|
boolean |
isAlignmentLoaded(Faction.Align align) |
Returns whether any factions are loaded that grant alignment.
|
boolean |
isFactionedThisWay(MOB mob,
Faction.FRange rangeCode) |
Returns whether the given mob has the faction represented
by the range, and whether their faction value falls within
that range.
|
boolean |
isFactionID(java.lang.String key) |
Returns whether the given string is a legitimate,
loadable faction id.
|
boolean |
isFactionLoaded(java.lang.String key) |
Returns whether the given string is the faction
id of an already loaded and cached faction.
|
boolean |
isRangeCodeName(java.lang.String key) |
Returns whether the given string is, in fact, a range
code for any existing faction.
|
java.lang.String |
listFactions() |
Returns a friendly column based list of
all factions, formatted for 80 col screen.
|
java.lang.String |
makeFactionFilename(java.lang.String factionID) |
Returns a cmfs path, relative to /resources (so, not including
that prefix) that the given faction id should be saved into.
|
Faction |
makeReactionFaction(java.lang.String prefix,
java.lang.String classID,
java.lang.String Name,
java.lang.String code,
java.lang.String baseTemplateFilename) |
Creates a reaction faction based from a template, to represent a specific
entity in the reaction category.
|
void |
modifyFaction(MOB mob,
Faction meF) |
This is an archon/system editor function to modify the specific
attributes and parameters of the given faction.
|
java.lang.String |
name() |
The displayable name of this object.
|
int |
numFactions() |
Return the total number of factions
|
boolean |
postChangeAllFactions(MOB mob,
MOB victim,
int amount,
boolean quiet) |
Posts an official faction change event to the system
without actually designating a faction that changed.
|
boolean |
postSkillFactionChange(MOB mob,
Ability skillA,
java.lang.String factionID,
int amount) |
Posts an official faction change even to the system
that is related to a skill that changes faction.
|
void |
propertiesLoaded() |
This method is called whenever system properties are altered by the user.
|
java.util.Map<java.lang.String,Faction.FRange> |
rangeCodeNames() |
|
java.lang.String |
rangeDescription(Faction.FRange FR,
java.lang.String andOr) |
Returns a friendly list of the ranges and the faction
name whose code matches a range in the given faction.
|
void |
reloadFactions(java.lang.String factionList) |
Given a semi-colon delimited list of faction
ids, this method will cause them all to be
cached into memory, if they exist.
|
boolean |
removeFaction(java.lang.String factionID) |
Deletes the faction from the memory cache with the
given faction id, or all of the factions if the faction
id is null.
|
java.lang.String |
resaveFaction(Faction F) |
Re-saves the given faction back to the cmfs.
|
void |
setAlignment(MOB mob,
Faction.Align newAlignment) |
Changes the alignment of the given mob to the value of the
Align enum given.
|
void |
setAlignmentOldRange(MOB mob,
int oldRange) |
A legacy method for changing alignment according to
the legacy values where 1000 is pure good, and 0 is evil.
|
boolean |
tick(Tickable ticking,
int tickID) |
this is the method which is called periodically by the threading engine.
|
void |
updatePlayerFactions(MOB mob,
Room R,
boolean forceAutoCheck) |
This function makes sure that any publicly available factions
which the given mob in the given location are applied to the
given mob, if they can be.
|
activate, getServiceClient, L, shutdowncopyOf, initializeClass, newInstanceclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitactivate, checkDatabase, compareTo, copyOf, getServiceClient, initializeClass, L, newInstance, setThreadStatus, shutdownpublic SHashtable<java.lang.String,Faction> factionMap
public SHashtable<java.lang.String,Faction.FRange> hashedFactionRanges
public java.util.Map<Faction.Align,java.util.List<Faction.FRange>> hashedFactionAligns
protected java.util.List<java.lang.String> autoReactions
public java.lang.String ID()
CMObjectID in interface CMObjectID in class StdLibrarypublic java.util.Enumeration<Faction> factions()
FactionManagerfactions in interface FactionManagerFaction,
FactionManager.numFactions(),
FactionManager.getFaction(String),
FactionManager.getFactionByNumber(int)public int numFactions()
FactionManagernumFactions in interface FactionManagerFactionManager.factions(),
FactionManager.getFaction(String),
FactionManager.getFactionByNumber(int)public void clearFactions()
FactionManagerclearFactions in interface FactionManagerpublic void propertiesLoaded()
CMLibrarypropertiesLoaded in interface CMLibrarypropertiesLoaded in class StdLibrarypublic Faction getFactionByNumber(int index)
FactionManagergetFactionByNumber in interface FactionManagerindex - the index numberFactionManager.factions(),
FactionManager.numFactions(),
FactionManager.getFaction(String)public void reloadFactions(java.lang.String factionList)
FactionManagerreloadFactions in interface FactionManagerfactionList - the list of factionspublic java.util.Map<java.lang.String,Faction.FRange> rangeCodeNames()
public boolean isRangeCodeName(java.lang.String key)
FactionManagerisRangeCodeName in interface FactionManagerkey - the string to checkFaction.FRangepublic Faction.FRange getFactionRangeByCodeName(java.lang.String rangeCodeName)
FactionManagergetFactionRangeByCodeName in interface FactionManagerrangeCodeName - the range code name to search forFactionManager.getFactionByRangeCodeName(String),
FactionManager.getRange(String, int),
FactionManager.getRanges(String)public boolean isFactionedThisWay(MOB mob, Faction.FRange rangeCode)
FactionManagerisFactionedThisWay in interface FactionManagermob - the mob to checkrangeCode - the faction range object to check the mob forpublic java.lang.String rangeDescription(Faction.FRange FR, java.lang.String andOr)
FactionManagerrangeDescription in interface FactionManagerFR - the faction range to matchandOr - the word to use when combining multiplespublic boolean addFaction(Faction F)
FactionManageraddFaction in interface FactionManagerF - the faction to addFaction,
FactionManager.removeFaction(String),
FactionManager.resaveFaction(Faction)public java.lang.String makeFactionFilename(java.lang.String factionID)
FactionManagermakeFactionFilename in interface FactionManagerfactionID - the faction id to build a filename forpublic boolean isFactionID(java.lang.String key)
FactionManagerisFactionID in interface FactionManagerkey - the string to checkFactionManager.isFactionLoaded(String)public boolean isFactionLoaded(java.lang.String key)
FactionManagerisFactionLoaded in interface FactionManagerkey - the faction id to checkFactionManager.isFactionID(String)public boolean isAlignmentLoaded(Faction.Align align)
FactionManagerisAlignmentLoaded in interface FactionManageralign - the align enum to checkFaction.Align,
FactionManager.getAlignPurity(int, com.planet_ink.coffee_mud.Common.interfaces.Faction.Align),
FactionManager.getAlignMedianFacValue(com.planet_ink.coffee_mud.Common.interfaces.Faction.Align),
FactionManager.getAlignEnum(String)public Faction getFaction(java.lang.String factionID)
FactionManagergetFaction in interface FactionManagerfactionID - the faction id to look forFactionManager.factions(),
FactionManager.numFactions(),
FactionManager.getFactionByNumber(int)public Faction getFactionByRangeCodeName(java.lang.String rangeCodeName)
FactionManagergetFactionByRangeCodeName in interface FactionManagerrangeCodeName - the range code name to search forFactionManager.getFactionRangeByCodeName(String),
FactionManager.getRange(String, int),
FactionManager.getRanges(String)public Faction getFactionByName(java.lang.String factionNamed)
FactionManagergetFactionByName in interface FactionManagerfactionNamed - the display name to look forFactionManager.getFaction(String)public boolean removeFaction(java.lang.String factionID)
FactionManagerremoveFaction in interface FactionManagerfactionID - the id to remove, or null for allFactionManager.addFaction(Faction),
FactionManager.resaveFaction(Faction)public java.lang.String listFactions()
FactionManagerlistFactions in interface FactionManagerpublic java.lang.String name()
CMObjectname in interface CMObjectname in interface Tickablename in class StdLibraryEnvironmental.Name()public int getTickStatus()
TickablegetTickStatus in interface TickablegetTickStatus in class StdLibraryTickable.tick(Tickable, int)public java.lang.String getName(java.lang.String factionID)
FactionManagergetName in interface FactionManagerfactionID - the faction id to look forpublic int getMinimum(java.lang.String factionID)
FactionManagergetMinimum in interface FactionManagerfactionID - the faction id to look forFactionManager.getMaximum(String)public int getMaximum(java.lang.String factionID)
FactionManagergetMaximum in interface FactionManagerfactionID - the faction id to look forFactionManager.getMinimum(String)public int getPercent(java.lang.String factionID,
int faction)
FactionManagergetPercent in interface FactionManagerfactionID - the faction id to get a range percent for.faction - the faction number to find the percent inFactionManager.getRangePercent(String, int),
FactionManager.getPercentFromAvg(String, int)public int getPercentFromAvg(java.lang.String factionID,
int faction)
FactionManagergetPercentFromAvg in interface FactionManagerfactionID - the faction id to get a range percent for.faction - the faction number to find the percent inFactionManager.getRangePercent(String, int),
FactionManager.getPercent(String, int),
FactionManager.getPercentFromAvg(String, int)public Faction.FRange getRange(java.lang.String factionID, int faction)
FactionManagergetRange in interface FactionManagerfactionID - the faction id of the faction to checkfaction - the amount of faction to find the range forFactionManager.getFactionByRangeCodeName(String),
FactionManager.getFactionRangeByCodeName(String),
FactionManager.getRanges(String)public java.util.Enumeration<Faction.FRange> getRanges(java.lang.String factionID)
FactionManagergetRanges in interface FactionManagerfactionID - the faction id of the faction to checkFactionManager.getFactionByRangeCodeName(String),
FactionManager.getFactionRangeByCodeName(String),
FactionManager.getRange(String, int)public double getRangePercent(java.lang.String factionID,
int faction)
FactionManagergetRangePercent in interface FactionManagerfactionID - the faction id to get a range percent for.faction - the faction number to find the percent inFactionManager.getPercent(String, int),
FactionManager.getPercentFromAvg(String, int)public int getTotal(java.lang.String factionID)
FactionManagergetTotal in interface FactionManagerfactionID - the faction id to checkpublic int getRandom(java.lang.String factionID)
FactionManagergetRandom in interface FactionManagerfactionID - the faction id to checkpublic java.lang.String getAlignmentID()
FactionManagergetAlignmentID in interface FactionManagerpublic java.lang.String getInclinationID()
FactionManagergetInclinationID in interface FactionManagerpublic void setAlignment(MOB mob, Faction.Align newAlignment)
FactionManagersetAlignment in interface FactionManagermob - the mob to changenewAlignment - the new alignment by enumFaction.Alignpublic void setAlignmentOldRange(MOB mob, int oldRange)
FactionManagersetAlignmentOldRange in interface FactionManagermob - the mob to changeoldRange - the 0-1000 valuepublic boolean postChangeAllFactions(MOB mob, MOB victim, int amount, boolean quiet)
FactionManagerpostChangeAllFactions in interface FactionManagermob - the mob whose factions have changedvictim - the victim causing the change, if anyamount - the amount of factions plus or minusquiet - true to be silent about the change, or false otherwisepublic boolean postSkillFactionChange(MOB mob, Ability skillA, java.lang.String factionID, int amount)
FactionManagerpostSkillFactionChange in interface FactionManagermob - the mob whose faction has changedskillA - the skill that caused the faction changefactionID - the faction id of the faction to changeamount - the amount, plus or minus, to changepublic Faction makeReactionFaction(java.lang.String prefix, java.lang.String classID, java.lang.String Name, java.lang.String code, java.lang.String baseTemplateFilename)
FactionManagermakeReactionFaction in interface FactionManagerprefix - prefix to add to the faction id to identify the reaction categoryclassID - the literal entity class/ID() - for use in masksName - the friendly name of the entity, prob also for masks or comm.code - the unique identifier for the entity, w/o spacesbaseTemplateFilename - the cmfs path of the template to base the reaction onpublic Faction getSpecialAreaFaction(Area A)
FactionManagergetSpecialAreaFaction in interface FactionManagerA - the Area to checkFactionManager.getSpecialFactions(MOB, Room)public Faction[] getSpecialFactions(MOB mob, Room R)
FactionManagergetSpecialFactions in interface FactionManagermob - the mob involvedR - the mobs locationFactionManager.getSpecialAreaFaction(Area)public void updatePlayerFactions(MOB mob, Room R, boolean forceAutoCheck)
FactionManagerupdatePlayerFactions in interface FactionManagermob - the player/npc mob to confirm against existing factionsR - the room the mob is inforceAutoCheck - just set this to falseprotected void addOutsidersAndTimers(Faction F, java.util.List<Faction.FactionChangeEvent> outSiders, java.util.List<Faction.FactionChangeEvent> timers)
public boolean tick(Tickable ticking, int tickID)
Tickabletick in interface Tickabletick in class StdLibraryticking - a reference to this Tickable objecttickID - the TICKID_ constant describing this periodic call, as defined in TickableTickable,
ServiceEngine,
TickableGrouppublic int getAlignPurity(int faction,
Faction.Align eq)
FactionManagergetAlignPurity in interface FactionManagerfaction - the faction valueeq - the alignment enumFaction.Align,
FactionManager.isAlignmentLoaded(com.planet_ink.coffee_mud.Common.interfaces.Faction.Align),
FactionManager.getAlignMedianFacValue(com.planet_ink.coffee_mud.Common.interfaces.Faction.Align),
FactionManager.getAlignEnum(String)public int getInclinationPurity(int faction,
Faction.Align eq)
FactionManagergetInclinationPurity in interface FactionManagerfaction - the faction valueeq - the alignment enumFaction.Alignpublic int getAlignMedianFacValue(Faction.Align eq)
FactionManagergetAlignMedianFacValue in interface FactionManagereq - the align fac value to return a pure value forFaction.Align,
FactionManager.isAlignmentLoaded(com.planet_ink.coffee_mud.Common.interfaces.Faction.Align),
FactionManager.getAlignPurity(int, com.planet_ink.coffee_mud.Common.interfaces.Faction.Align),
FactionManager.getAlignEnum(String)public Faction.FacTag getFactionTag(java.lang.String tag)
FactionManagergetFactionTag in interface FactionManagertag - the string to checkFaction.FacTagpublic Faction.Align getAlignEnum(java.lang.String str)
FactionManagergetAlignEnum in interface FactionManagerstr - the Align enum stringFaction.Align,
FactionManager.isAlignmentLoaded(com.planet_ink.coffee_mud.Common.interfaces.Faction.Align),
FactionManager.getAlignMedianFacValue(com.planet_ink.coffee_mud.Common.interfaces.Faction.Align),
FactionManager.getAlignPurity(int, com.planet_ink.coffee_mud.Common.interfaces.Faction.Align)public void modifyFaction(MOB mob, Faction meF) throws java.io.IOException
FactionManagermodifyFaction in interface FactionManagermob - the player doing the editing, with a sessionmeF - the faction object being editedjava.io.IOException - session i/o errorspublic java.lang.String resaveFaction(Faction F)
FactionManagerresaveFaction in interface FactionManagerF - the faction to saveFaction,
FactionManager.addFaction(Faction),
FactionManager.removeFaction(String)public FactionManager.FAbilityMaskType getAbilityFlagType(java.lang.String strflag)
FactionManagergetAbilityFlagType in interface FactionManagerstrflag - the string to find a flag type rep ofFactionManager.FAbilityMaskType