|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.planet_ink.coffee_mud.Libraries.StdLibrary
com.planet_ink.coffee_mud.Libraries.Clans
public class Clans
Portions Copyright (c) 2003 Jeremy Vyska Portions Copyright (c) 2004-2018 Bo Zimmerman Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
| Field Summary | |
|---|---|
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
|
| Fields inherited from class com.planet_ink.coffee_mud.Libraries.StdLibrary |
|---|
isDebugging, name, serviceClient, tickStatus |
| Constructor Summary | |
|---|---|
Clans()
|
|
| Method Summary | |
|---|---|
boolean |
activate()
Activates the library. |
void |
addClan(Clan C)
Adds the given clan to the games list |
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. |
void |
clanAnnounceAll(java.lang.String msg)
Sends a message to the games official CLAN chat channel. |
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 |
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. |
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. |
java.util.List<Pair<Clan,Clan>> |
findUncommonRivalrousClans(MOB M1,
MOB M2)
|
void |
forceTick()
Force the clans maintenance thread |
java.util.List<Pair<Clan,Clan>> |
getAllClanPairs(MOB M1,
MOB M2)
|
Clan |
getClan(java.lang.String id)
Returns the Clan object associated with the given 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. |
int |
getClanRelations(Clan C1,
Clan C2)
|
int |
getClanRelations(java.lang.String clanID1,
java.lang.String clanID2)
This method is used to determine the basic relationship between two clans. |
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. |
ClanGovernment |
getDefaultGovernment()
Returns the default government definition object. |
java.lang.String |
getGovernmentHelp(MOB mob,
java.lang.String named,
boolean exact)
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 |
isCommonClanRelations(Clan C1,
Clan C2,
int relation)
|
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. |
| Methods inherited from class com.planet_ink.coffee_mud.Libraries.StdLibrary |
|---|
checkDatabase, compareTo, copyOf, getServiceClient, getTickStatus, initializeClass, L, name, newInstance, setThreadStatus |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.planet_ink.coffee_mud.Libraries.interfaces.CMLibrary |
|---|
getServiceClient, L |
| Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CMObject |
|---|
copyOf, initializeClass, name, newInstance |
| Methods inherited from interface java.lang.Comparable |
|---|
compareTo |
| Field Detail |
|---|
protected SHashtable<java.lang.String,Clan> all
protected java.util.List<Pair<Clan,java.lang.Integer>> all2
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
| Constructor Detail |
|---|
public Clans()
| Method Detail |
|---|
public java.lang.String ID()
CMObject
ID in interface CMObjectID in class StdLibrary
public boolean isCommonClanRelations(Clan C1,
Clan C2,
int relation)
public boolean isCommonClanRelations(java.lang.String clanID1,
java.lang.String clanID2,
int relation)
ClanManager
isCommonClanRelations in interface ClanManagerclanID1 - the first clan to evaluateclanID2 - the second clan to evaluaterelation - the clan relation to compare to
Clan.REL_DESCS
public boolean isAtClanWar(MOB M1,
MOB M2)
ClanManager
isAtClanWar in interface ClanManagerM1 - the first mobs first rivalrous clan to evaluateM2 - the second mobs first rivalrous clan to evaluate
Clan.REL_DESCS
public boolean checkClanPrivilege(MOB mob,
Clan.Function func)
ClanManager
checkClanPrivilege in interface ClanManagermob - the mob to check the clans offunc - the function to check for
public boolean checkClanPrivilege(MOB mob,
java.lang.String clanID,
Clan.Function func)
ClanManager
checkClanPrivilege in interface ClanManagermob - the mob to look for privileges forclanID - the clanID to check for to check forfunc - the function to check for
public Pair<Clan,java.lang.Integer> findPrivilegedClan(MOB mob,
Clan.Function func)
ClanManager
findPrivilegedClan in interface ClanManagermob - the mob to check the clans offunc - the function to check for
public java.util.List<Pair<Clan,java.lang.Integer>> findPrivilegedClans(MOB mob,
Clan.Function func)
ClanManager
findPrivilegedClans in interface ClanManagermob - the mob to check the clans offunc - the function to check for
public Clan findRivalrousClan(MOB mob)
ClanManager
findRivalrousClan in interface ClanManagermob - the mob to check the clans of
public Clan findConquerableClan(MOB mob)
ClanManager
findConquerableClan in interface ClanManagermob - the mob to check the clans of
public java.util.List<Triad<Clan,java.lang.Integer,java.lang.Integer>> findCommonRivalrousClans(MOB mob1,
MOB mob2)
ClanManager
findCommonRivalrousClans in interface ClanManagermob1 - the first mob to check the clans ofmob2 - the second mob to check the clans of
public java.util.List<Pair<Clan,java.lang.Integer>> findRivalrousClans(MOB mob)
ClanManager
findRivalrousClans in interface ClanManagermob - the mob to check the clans of
public java.util.List<Pair<Clan,java.lang.Integer>> findRivalrousClans(MOB clanSourceMob,
MOB filterMob)
ClanManager
findRivalrousClans in interface ClanManagerclanSourceMob - the mob to source the clan list fromfilterMob - the mob to use to filter out source clans
public java.util.List<Pair<Clan,Clan>> findUncommonRivalrousClans(MOB M1,
MOB M2)
public java.util.List<Pair<Clan,Clan>> getAllClanPairs(MOB M1,
MOB M2)
public int getClanRelations(Clan C1,
Clan C2)
public int getClanRelations(java.lang.String clanID1,
java.lang.String clanID2)
ClanManager
getClanRelations in interface ClanManagerclanID1 - the first clan to evaluateclanID2 - the second clan to evaluate
Clan.REL_DESCS
public boolean findAnyClanRelations(MOB M1,
MOB M2,
int relation)
ClanManager
findAnyClanRelations in interface ClanManagerM1 - the first mob whose clans to evaluateM2 - the second mob whose clans to evaluaterelation - the relation to look for
Clan.REL_DESCS
public boolean isAnyCommonClan(MOB M1,
MOB M2)
ClanManager
isAnyCommonClan in interface ClanManagerM1 - first mobM2 - second mob
protected ClanManager[] getOtherClanLibAllHosts()
public Clan getClan(java.lang.String id)
ClanManager
getClan in interface ClanManagerid - the clan name
Clanpublic Clan getClanAnyHost(java.lang.String id)
ClanManager
getClanAnyHost in interface ClanManagerid - the clan name
Clanpublic Clan findClan(java.lang.String id)
ClanManager
findClan in interface ClanManagerid - the clan name
Clan
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 ClanManagerM - the mob to evaluatemembers - the members of a clan
public java.util.Enumeration<Clan> clans()
ClanManager
clans in interface ClanManagerpublic int numClans()
ClanManager
numClans in interface ClanManagerpublic void addClan(Clan C)
ClanManager
addClan in interface ClanManagerC - the clan to addpublic void removeClan(Clan C)
ClanManager
removeClan in interface ClanManagerC - the clan to removepublic void tickAllClans()
ClanManager
tickAllClans in interface ClanManagerpublic void clanAnnounceAll(java.lang.String msg)
ClanManager
clanAnnounceAll in interface ClanManagermsg - the message to sendpublic java.util.Enumeration<java.lang.String> clansNames()
ClanManager
clansNames in interface ClanManagerClanpublic java.util.Enumeration<java.lang.String> clansNamesAllHosts()
ClanManager
clansNamesAllHosts in interface ClanManagerpublic java.lang.Iterable<Pair<Clan,java.lang.Integer>> clanRoles()
ClanManager
clanRoles in interface ClanManagerpublic java.lang.String translatePrize(Clan.Trophy trophy)
ClanManager
translatePrize in interface ClanManagertrophy - the trophy code number
Clan.Trophypublic 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 ClanManagermob - 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.ACCEPTprotected java.lang.String indt(int x)
public long getLastGovernmentLoad()
ClanManager
getLastGovernmentLoad in interface ClanManager
public java.lang.String getGovernmentHelp(MOB mob,
java.lang.String named,
boolean exact)
ClanManager
getGovernmentHelp in interface ClanManagermob - the viewer of the government typenamed - the possible name of the governmentexact - true to only match exact, or false otherwise
public ClanGovernment createSampleGovernment()
ClanManager
createSampleGovernment in interface ClanManagerpublic void reSaveGovernmentsXML()
ClanManager
reSaveGovernmentsXML in interface ClanManagerpublic ClanGovernment createGovernment(java.lang.String name)
ClanManager
createGovernment in interface ClanManagername - governmentname
public boolean removeGovernment(ClanGovernment government)
ClanManager
removeGovernment in interface ClanManagergovernment - the government to delete
public ClanGovernment[] getStockGovernments()
ClanManager
getStockGovernments in interface ClanManagerClanGovernmentpublic ClanGovernment getDefaultGovernment()
ClanManager
getDefaultGovernment in interface ClanManagerClanGovernmentpublic ClanGovernment getStockGovernment(int typeid)
ClanManager
getStockGovernment in interface ClanManagertypeid - the internal typeid
ClanGovernmentpublic java.lang.String makeGovernmentXML(ClanGovernment gvt)
ClanManager
makeGovernmentXML in interface ClanManagergvt - the clan government object
ClanGovernment,
ClanManager.makeGovernmentXML(com.planet_ink.coffee_mud.Common.interfaces.ClanGovernment[]),
ClanManager.parseGovernmentXML(StringBuffer)public java.lang.String makeGovernmentXML(ClanGovernment[] gvts)
ClanManager
makeGovernmentXML in interface ClanManagergvts - the clan government objects
ClanGovernment,
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 ClanManagerM - the mob to evaluatecategory - the clan goverment category
public ClanGovernment[] parseGovernmentXML(java.lang.StringBuffer xml)
ClanManager
parseGovernmentXML in interface ClanManagerxml - the xml
ClanGovernment,
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 ClanManagerwebPath - a full vfs resource path
public java.lang.String getClanWebTemplateDir(java.lang.String webPath)
ClanManager
getClanWebTemplateDir in interface ClanManagerwebPath - a full vfs resource path
public Clan getWebPathClan(java.lang.String sitePath)
ClanManager
getWebPathClan in interface ClanManagersitePath - the absolute path of the web dir assigned to this clan
public void clanAnnounce(MOB mob,
java.lang.String msg)
ClanManager
clanAnnounce in interface ClanManagermob - 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)
public void clanTrophyScan()
public boolean activate()
CMLibrary
activate in interface CMLibraryactivate in class StdLibraryCMLibrary.shutdown()
public boolean tick(Tickable ticking,
int tickID)
Tickable
tick in interface Tickabletick in class StdLibraryticking - a reference to this Tickable objecttickID - the TICKID_ constant describing this periodic call, as defined in Tickable
Tickable,
ServiceEngine,
TickableGrouppublic boolean shutdown()
CMLibrary
shutdown in interface CMLibraryshutdown in class StdLibraryCMLibrary.activate()public void forceTick()
ClanManager
forceTick in interface ClanManagerpublic void propertiesLoaded()
CMLibrary
propertiesLoaded in interface CMLibrarypropertiesLoaded in class StdLibrary
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||