com.planet_ink.coffee_mud.Libraries
Class Factions

java.lang.Object
  extended by com.planet_ink.coffee_mud.Libraries.StdLibrary
      extended by com.planet_ink.coffee_mud.Libraries.Factions
All Implemented Interfaces:
CMObject, Tickable, CMLibrary, FactionManager, java.lang.Cloneable, java.lang.Comparable<CMObject>

public class Factions
extends StdLibrary
implements FactionManager

Portions Copyright (c) 2003 Jeremy Vyska

Portions Copyright (c) 2004-2008 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
 java.util.Hashtable factionSet
           
 java.util.Hashtable hashedFactionRanges
           
 
Fields inherited from interface com.planet_ink.coffee_mud.core.interfaces.Tickable
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_CLAN, TICKID_CLANITEM, TICKID_DEADBODY_DECAY, TICKID_EMAIL, TICKID_EXIT_BEHAVIOR, TICKID_EXIT_REOPEN, TICKID_ITEM_BEHAVIOR, TICKID_ITEM_BOUNCEBACK, TICKID_LIGHT_FLICKERS, TICKID_LIVEAUCTION, TICKID_LONGERMASK, TICKID_MOB, TICKID_QUEST, TICKID_READYTOSTOP, TICKID_ROOM_BEHAVIOR, TICKID_ROOM_ITEM_REJUV, TICKID_SPELL_AFFECT, TICKID_TIMEAUCTION, TICKID_TRAP_DESTRUCTION, TICKID_TRAP_RESET, TICKMASK_SOLITARY, TICKS_PER_RLMIN, TIME_MILIS_PER_MUDHOUR, TIME_TICK, TIME_TICK_DOUBLE
 
Constructor Summary
Factions()
           
 
Method Summary
 java.lang.String AlignID()
           
 void clearFactions()
           
 java.util.Hashtable factionSet()
           
 int getAbilityFlagType(java.lang.String strflag)
           
 int getAlignEquiv(java.lang.String str)
           
 int getAlignPurity(int faction, int AlignEq)
           
 int getAlignThingie(int AlignEq)
           
 Faction getFaction(java.lang.String factionID)
           
 Faction getFactionByName(java.lang.String factionNamed)
           
 Faction getFactionByRangeCodeName(java.lang.String rangeCodeName)
           
 int getMaximum(java.lang.String factionID)
           
 int getMinimum(java.lang.String factionID)
           
 java.lang.String getName(java.lang.String factionID)
           
 int getPercent(java.lang.String factionID, int faction)
           
 int getPercentFromAvg(java.lang.String factionID, int faction)
           
 int getRandom(java.lang.String factionID)
           
 Faction.FactionRange getRange(java.lang.String factionID, int faction)
           
 double getRangePercent(java.lang.String factionID, int faction)
           
 java.util.Enumeration getRanges(java.lang.String factionID)
           
 long getTickStatus()
          A coded status for this object during the period where its tick method is being called.
 int getTotal(java.lang.String factionID)
           
 java.lang.String ID()
          The CoffeeMud Java Class ID shared by all instances of this object.
 boolean isFactionedThisWay(MOB mob, java.lang.String rangeCodeName)
           
 int isFactionTag(java.lang.String tag)
           
 boolean isRangeCodeName(java.lang.String key)
           
 java.lang.String listFactions()
           
 void modifyFaction(MOB mob, Faction me)
           
 java.lang.String name()
          The nice displayable name of this instance of this object
 boolean postChangeAllFactions(MOB mob, MOB victim, int amount, boolean quiet)
           
 boolean postFactionChange(MOB mob, Environmental tool, java.lang.String factionID, int amount)
           
 java.util.Hashtable rangeCodeNames()
           
 java.lang.String rangeDescription(java.lang.String rangeCodeName, java.lang.String andOr)
           
 void reloadFactions(java.lang.String factionList)
           
 boolean removeFaction(java.lang.String factionID)
           
 java.lang.String resaveFaction(Faction F)
           
 void setAlignment(MOB mob, int newAlignment)
           
 void setAlignmentOldRange(MOB mob, int oldRange)
           
 boolean tick(Tickable ticking, int tickID)
          this is the method which is called periodically by the threading engine.
 
Methods inherited from class com.planet_ink.coffee_mud.Libraries.StdLibrary
activate, compareTo, copyOf, getSupportThread, initializeClass, newInstance, shutdown
 
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
activate, getSupportThread, shutdown
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CMObject
copyOf, initializeClass, newInstance
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CMObject
copyOf, initializeClass, newInstance
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

factionSet

public java.util.Hashtable factionSet

hashedFactionRanges

public java.util.Hashtable hashedFactionRanges
Constructor Detail

Factions

public Factions()
Method Detail

ID

public java.lang.String ID()
Description copied from interface: CMObject
The CoffeeMud Java Class ID shared by all instances of this object. Unlike the Java Class name, this method does not include package information. However, it must return a String value unique to its class category in the ClassLoader. Class categories include Libraries, Common, Areas, Abilities, Behaviors, CharClasses, Commands, Exits Locales, MOBS, Races, WebMacros, Basic Items, Armor, Weapons, ClanItems, MiscTech. The name is typically identical to the class name.

Specified by:
ID in interface CMObject
Overrides:
ID in class StdLibrary
Returns:
the name of this class

factionSet

public java.util.Hashtable factionSet()
Specified by:
factionSet in interface FactionManager

clearFactions

public void clearFactions()
Specified by:
clearFactions in interface FactionManager

reloadFactions

public void reloadFactions(java.lang.String factionList)
Specified by:
reloadFactions in interface FactionManager

rangeCodeNames

public java.util.Hashtable rangeCodeNames()
Specified by:
rangeCodeNames in interface FactionManager

isRangeCodeName

public boolean isRangeCodeName(java.lang.String key)
Specified by:
isRangeCodeName in interface FactionManager

isFactionedThisWay

public boolean isFactionedThisWay(MOB mob,
                                  java.lang.String rangeCodeName)
Specified by:
isFactionedThisWay in interface FactionManager

rangeDescription

public java.lang.String rangeDescription(java.lang.String rangeCodeName,
                                         java.lang.String andOr)
Specified by:
rangeDescription in interface FactionManager

getFaction

public Faction getFaction(java.lang.String factionID)
Specified by:
getFaction in interface FactionManager

getFactionByRangeCodeName

public Faction getFactionByRangeCodeName(java.lang.String rangeCodeName)
Specified by:
getFactionByRangeCodeName in interface FactionManager

getFactionByName

public Faction getFactionByName(java.lang.String factionNamed)
Specified by:
getFactionByName in interface FactionManager

removeFaction

public boolean removeFaction(java.lang.String factionID)
Specified by:
removeFaction in interface FactionManager

listFactions

public java.lang.String listFactions()
Specified by:
listFactions in interface FactionManager

name

public java.lang.String name()
Description copied from interface: Tickable
The nice displayable name of this instance of this object

Specified by:
name in interface Tickable
Returns:
the displayable name of this object instance

getTickStatus

public long getTickStatus()
Description copied from interface: Tickable
A coded status for this object during the period where its tick method is being called. The statis is defined, at least in part, by constants in this interface STATUS_*. STATUS_NOT should be returned when the objects tick method is not currently in execution. It should never return STATUS_NOT when the objects tick method is in execution.

Specified by:
getTickStatus in interface Tickable
Returns:
the numeric status of this object
See Also:
Tickable.tick(Tickable, int)

getName

public java.lang.String getName(java.lang.String factionID)
Specified by:
getName in interface FactionManager

getMinimum

public int getMinimum(java.lang.String factionID)
Specified by:
getMinimum in interface FactionManager

getMaximum

public int getMaximum(java.lang.String factionID)
Specified by:
getMaximum in interface FactionManager

getPercent

public int getPercent(java.lang.String factionID,
                      int faction)
Specified by:
getPercent in interface FactionManager

getPercentFromAvg

public int getPercentFromAvg(java.lang.String factionID,
                             int faction)
Specified by:
getPercentFromAvg in interface FactionManager

getRange

public Faction.FactionRange getRange(java.lang.String factionID,
                                     int faction)
Specified by:
getRange in interface FactionManager

getRanges

public java.util.Enumeration getRanges(java.lang.String factionID)
Specified by:
getRanges in interface FactionManager

getRangePercent

public double getRangePercent(java.lang.String factionID,
                              int faction)
Specified by:
getRangePercent in interface FactionManager

getTotal

public int getTotal(java.lang.String factionID)
Specified by:
getTotal in interface FactionManager

getRandom

public int getRandom(java.lang.String factionID)
Specified by:
getRandom in interface FactionManager

AlignID

public java.lang.String AlignID()
Specified by:
AlignID in interface FactionManager

setAlignment

public void setAlignment(MOB mob,
                         int newAlignment)
Specified by:
setAlignment in interface FactionManager

setAlignmentOldRange

public void setAlignmentOldRange(MOB mob,
                                 int oldRange)
Specified by:
setAlignmentOldRange in interface FactionManager

postChangeAllFactions

public boolean postChangeAllFactions(MOB mob,
                                     MOB victim,
                                     int amount,
                                     boolean quiet)
Specified by:
postChangeAllFactions in interface FactionManager

postFactionChange

public boolean postFactionChange(MOB mob,
                                 Environmental tool,
                                 java.lang.String factionID,
                                 int amount)
Specified by:
postFactionChange in interface FactionManager

tick

public boolean tick(Tickable ticking,
                    int tickID)
Description copied from interface: Tickable
this is the method which is called periodically by the threading engine. How often it is called depends on the parameters passed to the threadding engine when it is submitted for thread access. Typically the period is once per TIME_TICK period, but that is determined when the object is submitted to the thread engine.

Specified by:
tick in interface Tickable
Parameters:
ticking - a reference to this Tickable object
tickID - the TICKID_ constant describing this periodic call, as defined in Tickable
Returns:
true always, unless this object no longer wishes to ever tick again, in which case false
See Also:
Tickable, ServiceEngine, TickableGroup

getAlignPurity

public int getAlignPurity(int faction,
                          int AlignEq)
Specified by:
getAlignPurity in interface FactionManager

getAlignThingie

public int getAlignThingie(int AlignEq)
Specified by:
getAlignThingie in interface FactionManager

isFactionTag

public int isFactionTag(java.lang.String tag)
Specified by:
isFactionTag in interface FactionManager

getAlignEquiv

public int getAlignEquiv(java.lang.String str)
Specified by:
getAlignEquiv in interface FactionManager

modifyFaction

public void modifyFaction(MOB mob,
                          Faction me)
                   throws java.io.IOException
Specified by:
modifyFaction in interface FactionManager
Throws:
java.io.IOException

resaveFaction

public java.lang.String resaveFaction(Faction F)
Specified by:
resaveFaction in interface FactionManager

getAbilityFlagType

public int getAbilityFlagType(java.lang.String strflag)
Specified by:
getAbilityFlagType in interface FactionManager