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 |
idConverter
isDebugging, name, serviceClient, tickStatus
STATUS_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, shutdown
copyOf, initializeClass, newInstance
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
activate, checkDatabase, compareTo, copyOf, getServiceClient, initializeClass, L, newInstance, setThreadStatus, shutdown
public 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()
CMObject
ID
in interface CMObject
ID
in class StdLibrary
public java.util.Enumeration<Faction> factions()
FactionManager
factions
in interface FactionManager
Faction
,
FactionManager.numFactions()
,
FactionManager.getFaction(String)
,
FactionManager.getFactionByNumber(int)
public int numFactions()
FactionManager
numFactions
in interface FactionManager
FactionManager.factions()
,
FactionManager.getFaction(String)
,
FactionManager.getFactionByNumber(int)
public void clearFactions()
FactionManager
clearFactions
in interface FactionManager
public void propertiesLoaded()
CMLibrary
propertiesLoaded
in interface CMLibrary
propertiesLoaded
in class StdLibrary
public Faction getFactionByNumber(int index)
FactionManager
getFactionByNumber
in interface FactionManager
index
- the index numberFactionManager.factions()
,
FactionManager.numFactions()
,
FactionManager.getFaction(String)
public void reloadFactions(java.lang.String factionList)
FactionManager
reloadFactions
in interface FactionManager
factionList
- the list of factionspublic java.util.Map<java.lang.String,Faction.FRange> rangeCodeNames()
public boolean isRangeCodeName(java.lang.String key)
FactionManager
isRangeCodeName
in interface FactionManager
key
- the string to checkFaction.FRange
public Faction.FRange getFactionRangeByCodeName(java.lang.String rangeCodeName)
FactionManager
getFactionRangeByCodeName
in interface FactionManager
rangeCodeName
- the range code name to search forFactionManager.getFactionByRangeCodeName(String)
,
FactionManager.getRange(String, int)
,
FactionManager.getRanges(String)
public boolean isFactionedThisWay(MOB mob, Faction.FRange rangeCode)
FactionManager
isFactionedThisWay
in interface FactionManager
mob
- the mob to checkrangeCode
- the faction range object to check the mob forpublic java.lang.String rangeDescription(Faction.FRange FR, java.lang.String andOr)
FactionManager
rangeDescription
in interface FactionManager
FR
- the faction range to matchandOr
- the word to use when combining multiplespublic boolean addFaction(Faction F)
FactionManager
addFaction
in interface FactionManager
F
- the faction to addFaction
,
FactionManager.removeFaction(String)
,
FactionManager.resaveFaction(Faction)
public java.lang.String makeFactionFilename(java.lang.String factionID)
FactionManager
makeFactionFilename
in interface FactionManager
factionID
- the faction id to build a filename forpublic boolean isFactionID(java.lang.String key)
FactionManager
isFactionID
in interface FactionManager
key
- the string to checkFactionManager.isFactionLoaded(String)
public boolean isFactionLoaded(java.lang.String key)
FactionManager
isFactionLoaded
in interface FactionManager
key
- the faction id to checkFactionManager.isFactionID(String)
public boolean isAlignmentLoaded(Faction.Align align)
FactionManager
isAlignmentLoaded
in interface FactionManager
align
- 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)
FactionManager
getFaction
in interface FactionManager
factionID
- the faction id to look forFactionManager.factions()
,
FactionManager.numFactions()
,
FactionManager.getFactionByNumber(int)
public Faction getFactionByRangeCodeName(java.lang.String rangeCodeName)
FactionManager
getFactionByRangeCodeName
in interface FactionManager
rangeCodeName
- the range code name to search forFactionManager.getFactionRangeByCodeName(String)
,
FactionManager.getRange(String, int)
,
FactionManager.getRanges(String)
public Faction getFactionByName(java.lang.String factionNamed)
FactionManager
getFactionByName
in interface FactionManager
factionNamed
- the display name to look forFactionManager.getFaction(String)
public boolean removeFaction(java.lang.String factionID)
FactionManager
removeFaction
in interface FactionManager
factionID
- the id to remove, or null for allFactionManager.addFaction(Faction)
,
FactionManager.resaveFaction(Faction)
public java.lang.String listFactions()
FactionManager
listFactions
in interface FactionManager
public java.lang.String name()
CMObject
name
in interface CMObject
name
in interface Tickable
name
in class StdLibrary
Environmental.Name()
public int getTickStatus()
Tickable
getTickStatus
in interface Tickable
getTickStatus
in class StdLibrary
Tickable.tick(Tickable, int)
public java.lang.String getName(java.lang.String factionID)
FactionManager
getName
in interface FactionManager
factionID
- the faction id to look forpublic int getMinimum(java.lang.String factionID)
FactionManager
getMinimum
in interface FactionManager
factionID
- the faction id to look forFactionManager.getMaximum(String)
public int getMaximum(java.lang.String factionID)
FactionManager
getMaximum
in interface FactionManager
factionID
- the faction id to look forFactionManager.getMinimum(String)
public int getPercent(java.lang.String factionID, int faction)
FactionManager
getPercent
in interface FactionManager
factionID
- 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)
FactionManager
getPercentFromAvg
in interface FactionManager
factionID
- 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)
FactionManager
getRange
in interface FactionManager
factionID
- 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)
FactionManager
getRanges
in interface FactionManager
factionID
- 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)
FactionManager
getRangePercent
in interface FactionManager
factionID
- 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)
FactionManager
getTotal
in interface FactionManager
factionID
- the faction id to checkpublic int getRandom(java.lang.String factionID)
FactionManager
getRandom
in interface FactionManager
factionID
- the faction id to checkpublic java.lang.String getAlignmentID()
FactionManager
getAlignmentID
in interface FactionManager
public java.lang.String getInclinationID()
FactionManager
getInclinationID
in interface FactionManager
public void setAlignment(MOB mob, Faction.Align newAlignment)
FactionManager
setAlignment
in interface FactionManager
mob
- the mob to changenewAlignment
- the new alignment by enumFaction.Align
public void setAlignmentOldRange(MOB mob, int oldRange)
FactionManager
setAlignmentOldRange
in interface FactionManager
mob
- the mob to changeoldRange
- the 0-1000 valuepublic boolean postChangeAllFactions(MOB mob, MOB victim, int amount, boolean quiet)
FactionManager
postChangeAllFactions
in interface FactionManager
mob
- 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)
FactionManager
postSkillFactionChange
in interface FactionManager
mob
- 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)
FactionManager
makeReactionFaction
in interface FactionManager
prefix
- 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)
FactionManager
getSpecialAreaFaction
in interface FactionManager
A
- the Area to checkFactionManager.getSpecialFactions(MOB, Room)
public Faction[] getSpecialFactions(MOB mob, Room R)
FactionManager
getSpecialFactions
in interface FactionManager
mob
- the mob involvedR
- the mobs locationFactionManager.getSpecialAreaFaction(Area)
public void updatePlayerFactions(MOB mob, Room R, boolean forceAutoCheck)
FactionManager
updatePlayerFactions
in interface FactionManager
mob
- 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)
Tickable
tick
in interface Tickable
tick
in class StdLibrary
ticking
- a reference to this Tickable objecttickID
- the TICKID_ constant describing this periodic call, as defined in TickableTickable
,
ServiceEngine
,
TickableGroup
public int getAlignPurity(int faction, Faction.Align eq)
FactionManager
getAlignPurity
in interface FactionManager
faction
- 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)
FactionManager
getInclinationPurity
in interface FactionManager
faction
- the faction valueeq
- the alignment enumFaction.Align
public int getAlignMedianFacValue(Faction.Align eq)
FactionManager
getAlignMedianFacValue
in interface FactionManager
eq
- 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)
FactionManager
getFactionTag
in interface FactionManager
tag
- the string to checkFaction.FacTag
public Faction.Align getAlignEnum(java.lang.String str)
FactionManager
getAlignEnum
in interface FactionManager
str
- 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
FactionManager
modifyFaction
in interface FactionManager
mob
- 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)
FactionManager
resaveFaction
in interface FactionManager
F
- the faction to saveFaction
,
FactionManager.addFaction(Faction)
,
FactionManager.removeFaction(String)
public FactionManager.FAbilityMaskType getAbilityFlagType(java.lang.String strflag)
FactionManager
getAbilityFlagType
in interface FactionManager
strflag
- the string to find a flag type rep ofFactionManager.FAbilityMaskType