CMObject
, Tickable
, ClanManager
, CMLibrary
, java.lang.Cloneable
, java.lang.Comparable<CMObject>
public class Clans extends StdLibrary implements ClanManager
Modifier and Type | Field | Description |
---|---|---|
protected SHashtable<java.lang.String,Clan> |
all |
|
protected java.util.List<Pair<Clan,java.lang.Integer>> |
all2 |
|
protected ClanManager[] |
clanLibList |
|
protected java.util.Map<java.lang.String,java.lang.String> |
clanWebPathMappings |
|
protected long |
lastGovernmentLoad |
|
protected java.util.Map<java.lang.String,Clan> |
webPathClanMappings |
|
protected SHashtable<java.lang.String,java.lang.Object> |
xpAwardMap |
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 |
---|---|
Clans() |
Modifier and Type | Method | Description |
---|---|---|
boolean |
activate() |
Activates the library.
|
void |
addClan(Clan C) |
Adds the given clan to the games list
|
int |
adjustXPAward(Clan.Trophy trophy,
int exp) |
Adjust the given experience by the award granted by the given trophy.
|
protected void |
awardTrophyPrize(Clan winnerC,
Clan.Trophy trophy) |
|
boolean |
checkClanPrivilege(MOB mob,
Clan.Function func) |
Returns whether the given clan set contains a clan that
allows the given mob to do the given function in the clan.
|
boolean |
checkClanPrivilege(MOB mob,
java.lang.String clanID,
Clan.Function func) |
Returns whether the given mob belongs to the given clan, and if
so, whether they can do the given function in the clan.
|
void |
clanAnnounce(MOB mob,
java.lang.String msg) |
Makes an announcement to the clan announcement channel from
the given mob.
|
protected void |
clanAnnounceAll(java.lang.String msg) |
|
void |
clanDues() |
|
java.lang.Iterable<Pair<Clan,java.lang.Integer>> |
clanRoles() |
Returns all clans and their last-cached accept-positions
The auto-positions may be inaccurate.
|
java.util.Enumeration<Clan> |
clans() |
Returns an enumeration of all the Clans in the game
|
java.util.Enumeration<java.lang.String> |
clansNames() |
Returns a list of all available clans names in the game,
as Clan objects.
|
java.util.Enumeration<java.lang.String> |
clansNamesAllHosts() |
Returns a list of all available clan names for all clan
managers that share a single map.
|
void |
clanTrophyScan() |
|
ClanGovernment |
createGovernment(java.lang.String name) |
Creates the new stock government
|
ClanGovernment |
createSampleGovernment() |
Creates, but does not add, a sample government object
|
Clan |
fetchClanAnyHost(java.lang.String id) |
Returns the Clan object associated with the given clan name
from any host sharing the same map as the caller,
strictly matching, case insensitive
|
protected int |
filterMedianLevel(java.util.List<Clan.FullMemberRecord> members) |
|
boolean |
findAnyClanRelations(MOB M1,
MOB M2,
int relation) |
This method is used to determine the basic relationship between two mobs clans.
|
Clan |
findClan(java.lang.String id) |
Returns the Clan object associated with the given clan name, or
if the name is not found, the name that most closely matches it.
|
java.util.List<Triad<Clan,java.lang.Integer,java.lang.Integer>> |
findCommonRivalrousClans(MOB mob1,
MOB mob2) |
Searches for all clans that can be rivalrous with other clans that are
commonly shared between two mobs, along with their two roles
|
Clan |
findConquerableClan(MOB mob) |
Searches for a clan in the list that can be conquerable with other clans.
|
java.lang.String |
findGovernmentName(java.lang.String named,
boolean exact) |
Find the name of a government, or, if exactness is not
required, a position in a government.
|
Pair<Clan,java.lang.Integer> |
findPrivilegedClan(MOB mob,
Clan.Function func) |
If the given mob belongs to a clan, and if they can do the
given function in a clan, this will return that clan object
and the integer.
|
java.util.List<Pair<Clan,java.lang.Integer>> |
findPrivilegedClans(MOB mob,
Clan.Function func) |
If the given mob belongs to a clan, and if they can do the
given function in a clan, this will return those clan objects
and their role integer.
|
Clan |
findRivalrousClan(MOB mob) |
Searches for a clan in the list that can be rivalrous with other clans.
|
java.util.List<Pair<Clan,java.lang.Integer>> |
findRivalrousClans(MOB mob) |
Searches for all clans that can be rivalrous with other clans.
|
java.util.List<Pair<Clan,java.lang.Integer>> |
findRivalrousClans(MOB clanSourceMob,
MOB filterMob) |
Returns a list of clans that the source mob belongs to which the filter
mob does NOT also belong.
|
protected java.util.List<Pair<Clan,Clan>> |
findUncommonRivalrousClans(MOB M1,
MOB M2) |
|
void |
forceTick() |
Force the clans maintenance thread
|
protected java.util.List<Pair<Clan,Clan>> |
getAllClanPairs(MOB M1,
MOB M2) |
|
java.util.List<Clan> |
getAllCommonClanRelations(Clan C,
int rel) |
Returns all existing clans who have the given common relationship with
the given clan.
|
Clan |
getClan(java.lang.String id) |
Returns the Clan object associated with the given clan name
or which is a substring of a clan name
|
Clan |
getClanAnyHost(java.lang.String id) |
Returns the Clan object associated with the given clan name
from any host sharing the same map as the caller.
|
Clan |
getClanExact(java.lang.String id) |
Returns the Clan object associated with the given clan name
strictly matching, case insensitive
|
java.util.List<Pair<Clan,java.lang.Integer>> |
getClansByCategory(MOB M,
java.lang.String category) |
Returns the list of clans this mob belongs to in the given category.
|
java.lang.String |
getClanWebTemplateDir(java.lang.String webPath) |
Returns the template vfs path associated with a given specific
web path.
|
int |
getCommonClanRelations(Clan C1,
Clan C2) |
This method is used to determine the basic relationship between two clans.
|
int |
getCommonClanRelations(java.lang.String clanID1,
java.lang.String clanID2) |
This method is used to determine the basic relationship between two clans.
|
ClanGovernment |
getDefaultGovernment() |
Returns the default government definition object.
|
java.lang.String |
getGovernmentHelp(MOB mob,
java.lang.String named) |
Returns help on the government type named, if it is available
|
long |
getLastGovernmentLoad() |
Get last time governments were loaded/updated
|
protected ClanManager[] |
getOtherClanLibAllHosts() |
|
ClanGovernment |
getStockGovernment(int typeid) |
Returns a government definition object of the given internal
stock clangovernments.xml id.
|
ClanGovernment[] |
getStockGovernments() |
Returns all government definition objects from internal
stock clangovernments.xml file.
|
protected Clan |
getTrophyWinner(Clan.Trophy trophy) |
|
Clan |
getWebPathClan(java.lang.String sitePath) |
Returns the clan which may or may not be assigned to the absolute file path specified.
|
Clan |
getWebPathClanMapping(java.lang.String webPath) |
Returns the clan associated with a given specific web path.
|
boolean |
goForward(MOB mob,
Clan C,
java.util.List<java.lang.String> commands,
Clan.Function function,
boolean voteIfNecessary) |
Examines the given command string, which is based on the given clan function code.
|
java.lang.String |
ID() |
The CoffeeMud Java Class ID shared by all instances of
this object.
|
protected java.lang.String |
indt(int x) |
|
boolean |
isAnyCommonClan(MOB M1,
MOB M2) |
Returns whether the two mobs share ANY common clans, even
non-rivalrous ones.
|
boolean |
isAtClanWar(MOB M1,
MOB M2) |
This method is used to determine the basic relationship between two clan members.
|
boolean |
isClanFriendly(MOB mob,
Clan C) |
Returns whether the given mob is in a friendly state with with given clan.
|
boolean |
isClanFriendly(MOB M1,
MOB M2) |
Returns whether the two given mobs are in a clan friendly state
with each other.
|
boolean |
isClanFriendly(MOB M1,
java.lang.String clanID) |
Returns whether the given mob is in a friendly state with with given clan.
|
boolean |
isCommonClanRelations(java.lang.String clanID1,
java.lang.String clanID2,
int relation) |
This method is used to determine the basic relationship between two clans.
|
boolean |
isFamilyOfMembership(MOB M,
java.util.List<Clan.MemberRecord> members) |
Returns whether the given MOB is a member of any of the families
represented by the given list of clan members.
|
protected boolean |
isMember(java.util.List<Clan.MemberRecord> members,
java.lang.String name) |
|
java.lang.String |
makeGovernmentXML(ClanGovernment gvt) |
Converts a given clan government object into xml.
|
java.lang.String |
makeGovernmentXML(ClanGovernment[] gvts) |
Converts a given clan government objects into xml.
|
int |
numClans() |
Returns the number of clans in the game.
|
ClanGovernment[] |
parseGovernmentXML(java.lang.StringBuffer xml) |
Converts xml into clan government objects.
|
void |
propertiesLoaded() |
This method is called whenever system properties are altered by the user.
|
void |
removeClan(Clan C) |
Removes the given clan from the games list
|
boolean |
removeGovernment(ClanGovernment government) |
Deletes the stock government..
|
void |
reSaveGovernmentsXML() |
Forces the stock governments to be re-saved to clangovernments.xml.
|
boolean |
shutdown() |
Shuts down the library.
|
boolean |
tick(Tickable ticking,
int tickID) |
this is the method which is called periodically by the threading engine.
|
void |
tickAllClans() |
Forces all clans to go through their maintenance process, which
normally only occurs infrequently.
|
java.lang.String |
translatePrize(Clan.Trophy trophy) |
Returns a descriptive name for the given trophy code number.
|
boolean |
trophySystemActive() |
Returns whether this mud has activated its trophy system for clans.
|
getServiceClient, L
copyOf, initializeClass, name, newInstance
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
checkDatabase, compareTo, copyOf, getServiceClient, getTickStatus, initializeClass, L, name, newInstance, setThreadStatus
protected SHashtable<java.lang.String,Clan> all
protected long lastGovernmentLoad
protected java.util.Map<java.lang.String,Clan> webPathClanMappings
protected java.util.Map<java.lang.String,java.lang.String> clanWebPathMappings
protected ClanManager[] clanLibList
protected SHashtable<java.lang.String,java.lang.Object> xpAwardMap
public java.lang.String ID()
CMObject
ID
in interface CMObject
ID
in class StdLibrary
public boolean isCommonClanRelations(java.lang.String clanID1, java.lang.String clanID2, int relation)
ClanManager
isCommonClanRelations
in interface ClanManager
clanID1
- the first clan to evaluateclanID2
- the second clan to evaluaterelation
- the clan relation to compare toClan.REL_DESCS
public boolean isAtClanWar(MOB M1, MOB M2)
ClanManager
isAtClanWar
in interface ClanManager
M1
- the first mobs first rivalrous clan to evaluateM2
- the second mobs first rivalrous clan to evaluateClan.REL_DESCS
public boolean isClanFriendly(MOB M1, MOB M2)
ClanManager
isClanFriendly
in interface ClanManager
M1
- the first mob to checkM2
- the second mob to checkClanManager.isClanFriendly(MOB, Clan)
,
ClanManager.isClanFriendly(MOB, String)
public boolean isClanFriendly(MOB mob, Clan C)
ClanManager
isClanFriendly
in interface ClanManager
mob
- the mob to checkC
- the clan to checkClanManager.isClanFriendly(MOB, String)
,
ClanManager.isClanFriendly(MOB, MOB)
public boolean isClanFriendly(MOB M1, java.lang.String clanID)
ClanManager
isClanFriendly
in interface ClanManager
M1
- the mob to checkclanID
- the clan id to checkClanManager.isClanFriendly(MOB, Clan)
,
ClanManager.isClanFriendly(MOB, MOB)
public boolean checkClanPrivilege(MOB mob, Clan.Function func)
ClanManager
checkClanPrivilege
in interface ClanManager
mob
- the mob to check the clans offunc
- the function to check forpublic boolean checkClanPrivilege(MOB mob, java.lang.String clanID, Clan.Function func)
ClanManager
checkClanPrivilege
in interface ClanManager
mob
- the mob to look for privileges forclanID
- the clanID to check for to check forfunc
- the function to check forpublic Pair<Clan,java.lang.Integer> findPrivilegedClan(MOB mob, Clan.Function func)
ClanManager
findPrivilegedClan
in interface ClanManager
mob
- the mob to check the clans offunc
- the function to check forpublic java.util.List<Pair<Clan,java.lang.Integer>> findPrivilegedClans(MOB mob, Clan.Function func)
ClanManager
findPrivilegedClans
in interface ClanManager
mob
- the mob to check the clans offunc
- the function to check forpublic Clan findRivalrousClan(MOB mob)
ClanManager
findRivalrousClan
in interface ClanManager
mob
- the mob to check the clans ofpublic Clan findConquerableClan(MOB mob)
ClanManager
findConquerableClan
in interface ClanManager
mob
- the mob to check the clans ofpublic java.util.List<Triad<Clan,java.lang.Integer,java.lang.Integer>> findCommonRivalrousClans(MOB mob1, MOB mob2)
ClanManager
findCommonRivalrousClans
in interface ClanManager
mob1
- the first mob to check the clans ofmob2
- the second mob to check the clans ofpublic java.util.List<Pair<Clan,java.lang.Integer>> findRivalrousClans(MOB mob)
ClanManager
findRivalrousClans
in interface ClanManager
mob
- the mob to check the clans ofpublic java.util.List<Pair<Clan,java.lang.Integer>> findRivalrousClans(MOB clanSourceMob, MOB filterMob)
ClanManager
findRivalrousClans
in interface ClanManager
clanSourceMob
- the mob to source the clan list fromfilterMob
- the mob to use to filter out source clansprotected java.util.List<Pair<Clan,Clan>> findUncommonRivalrousClans(MOB M1, MOB M2)
public int getCommonClanRelations(Clan C1, Clan C2)
ClanManager
getCommonClanRelations
in interface ClanManager
C1
- the first clan to evaluateC2
- the second clan to evaluateClan.REL_DESCS
public java.util.List<Clan> getAllCommonClanRelations(Clan C, int rel)
ClanManager
getAllCommonClanRelations
in interface ClanManager
C
- the clan to find relations withrel
- the relationship to find, usually war or allypublic int getCommonClanRelations(java.lang.String clanID1, java.lang.String clanID2)
ClanManager
getCommonClanRelations
in interface ClanManager
clanID1
- the first clan to evaluateclanID2
- the second clan to evaluateClan.REL_DESCS
public boolean findAnyClanRelations(MOB M1, MOB M2, int relation)
ClanManager
findAnyClanRelations
in interface ClanManager
M1
- the first mob whose clans to evaluateM2
- the second mob whose clans to evaluaterelation
- the relation to look forClan.REL_DESCS
public boolean isAnyCommonClan(MOB M1, MOB M2)
ClanManager
isAnyCommonClan
in interface ClanManager
M1
- first mobM2
- second mobprotected ClanManager[] getOtherClanLibAllHosts()
public Clan getClan(java.lang.String id)
ClanManager
getClan
in interface ClanManager
id
- the clan nameClan
public Clan getClanExact(java.lang.String id)
ClanManager
getClanExact
in interface ClanManager
id
- the clan nameClan
public Clan fetchClanAnyHost(java.lang.String id)
ClanManager
fetchClanAnyHost
in interface ClanManager
id
- the clan nameClan
public Clan getClanAnyHost(java.lang.String id)
ClanManager
getClanAnyHost
in interface ClanManager
id
- the clan nameClan
public Clan findClan(java.lang.String id)
ClanManager
findClan
in interface ClanManager
id
- the clan nameClan
protected boolean isMember(java.util.List<Clan.MemberRecord> members, java.lang.String name)
public boolean isFamilyOfMembership(MOB M, java.util.List<Clan.MemberRecord> members)
ClanManager
isFamilyOfMembership
in interface ClanManager
M
- the mob to evaluatemembers
- the members of a clanpublic java.util.Enumeration<Clan> clans()
ClanManager
clans
in interface ClanManager
public int numClans()
ClanManager
numClans
in interface ClanManager
public void addClan(Clan C)
ClanManager
addClan
in interface ClanManager
C
- the clan to addpublic void removeClan(Clan C)
ClanManager
removeClan
in interface ClanManager
C
- the clan to removepublic void tickAllClans()
ClanManager
tickAllClans
in interface ClanManager
protected void clanAnnounceAll(java.lang.String msg)
public java.util.Enumeration<java.lang.String> clansNames()
ClanManager
clansNames
in interface ClanManager
Clan
public java.util.Enumeration<java.lang.String> clansNamesAllHosts()
ClanManager
clansNamesAllHosts
in interface ClanManager
public java.lang.Iterable<Pair<Clan,java.lang.Integer>> clanRoles()
ClanManager
clanRoles
in interface ClanManager
public java.lang.String translatePrize(Clan.Trophy trophy)
ClanManager
translatePrize
in interface ClanManager
trophy
- the trophy code numberClan.Trophy
public boolean trophySystemActive()
ClanManager
trophySystemActive
in interface ClanManager
public boolean goForward(MOB mob, Clan C, java.util.List<java.lang.String> commands, Clan.Function function, boolean voteIfNecessary)
ClanManager
goForward
in interface ClanManager
mob
- the player who wants to perform the functionC
- the clan that the player belongs tocommands
- the command list describing the function that wants to be executedfunction
- the function code described by the commands listvoteIfNecessary
- true to start a vote if one is needed, false to just return true.Clan.Function.ACCEPT
protected java.lang.String indt(int x)
public long getLastGovernmentLoad()
ClanManager
getLastGovernmentLoad
in interface ClanManager
public java.lang.String findGovernmentName(java.lang.String named, boolean exact)
ClanManager
findGovernmentName
in interface ClanManager
named
- the government name for exact, or position nameexact
- true for exact match only, false otherwiseClanManager.getGovernmentHelp(MOB, String)
public java.lang.String getGovernmentHelp(MOB mob, java.lang.String named)
ClanManager
getGovernmentHelp
in interface ClanManager
mob
- the viewer of the government typenamed
- the possible name of the governmentClanManager.findGovernmentName(String, boolean)
public ClanGovernment createSampleGovernment()
ClanManager
createSampleGovernment
in interface ClanManager
public void reSaveGovernmentsXML()
ClanManager
reSaveGovernmentsXML
in interface ClanManager
public ClanGovernment createGovernment(java.lang.String name)
ClanManager
createGovernment
in interface ClanManager
name
- governmentnamepublic boolean removeGovernment(ClanGovernment government)
ClanManager
removeGovernment
in interface ClanManager
government
- the government to deletepublic ClanGovernment[] getStockGovernments()
ClanManager
getStockGovernments
in interface ClanManager
ClanGovernment
public ClanGovernment getDefaultGovernment()
ClanManager
getDefaultGovernment
in interface ClanManager
ClanGovernment
public ClanGovernment getStockGovernment(int typeid)
ClanManager
getStockGovernment
in interface ClanManager
typeid
- the internal typeidClanGovernment
public java.lang.String makeGovernmentXML(ClanGovernment gvt)
ClanManager
makeGovernmentXML
in interface ClanManager
gvt
- the clan government objectClanGovernment
,
ClanManager.makeGovernmentXML(com.planet_ink.coffee_mud.Common.interfaces.ClanGovernment[])
,
ClanManager.parseGovernmentXML(StringBuffer)
public java.lang.String makeGovernmentXML(ClanGovernment[] gvts)
ClanManager
makeGovernmentXML
in interface ClanManager
gvts
- the clan government objectsClanGovernment
,
ClanManager.makeGovernmentXML(com.planet_ink.coffee_mud.Common.interfaces.ClanGovernment)
,
ClanManager.parseGovernmentXML(StringBuffer)
public java.util.List<Pair<Clan,java.lang.Integer>> getClansByCategory(MOB M, java.lang.String category)
ClanManager
getClansByCategory
in interface ClanManager
M
- the mob to evaluatecategory
- the clan goverment categorypublic ClanGovernment[] parseGovernmentXML(java.lang.StringBuffer xml)
ClanManager
parseGovernmentXML
in interface ClanManager
xml
- the xmlClanGovernment
,
ClanManager.makeGovernmentXML(com.planet_ink.coffee_mud.Common.interfaces.ClanGovernment)
,
ClanManager.makeGovernmentXML(com.planet_ink.coffee_mud.Common.interfaces.ClanGovernment[])
public Clan getWebPathClanMapping(java.lang.String webPath)
ClanManager
getWebPathClanMapping
in interface ClanManager
webPath
- a full vfs resource pathpublic java.lang.String getClanWebTemplateDir(java.lang.String webPath)
ClanManager
getClanWebTemplateDir
in interface ClanManager
webPath
- a full vfs resource pathpublic Clan getWebPathClan(java.lang.String sitePath)
ClanManager
getWebPathClan
in interface ClanManager
sitePath
- the absolute path of the web dir assigned to this clanpublic void clanAnnounce(MOB mob, java.lang.String msg)
ClanManager
clanAnnounce
in interface ClanManager
mob
- the mob who is announcing the messagemsg
- string message to send to the clan info channelsprotected int filterMedianLevel(java.util.List<Clan.FullMemberRecord> members)
protected Clan getTrophyWinner(Clan.Trophy trophy)
protected void awardTrophyPrize(Clan winnerC, Clan.Trophy trophy)
public void clanDues()
public void clanTrophyScan()
public int adjustXPAward(Clan.Trophy trophy, int exp)
ClanManager
adjustXPAward
in interface ClanManager
trophy
- the trophy to awardexp
- the amount of exp to possibly changepublic boolean activate()
CMLibrary
activate
in interface CMLibrary
activate
in class StdLibrary
CMLibrary.shutdown()
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 boolean shutdown()
CMLibrary
shutdown
in interface CMLibrary
shutdown
in class StdLibrary
CMLibrary.activate()
public void forceTick()
ClanManager
forceTick
in interface ClanManager
public void propertiesLoaded()
CMLibrary
propertiesLoaded
in interface CMLibrary
propertiesLoaded
in class StdLibrary