com.planet_ink.coffee_mud.Locales
Class StdGrid

java.lang.Object
  extended by com.planet_ink.coffee_mud.Locales.StdRoom
      extended by com.planet_ink.coffee_mud.Locales.StdGrid
All Implemented Interfaces:
GridZones, Affectable, Behavable, CMObject, Contingent, Environmental, ItemPossessor, Modifiable, MsgListener, Physical, PhysicalAgent, StatsAffecting, Tickable, GridLocale, Room, java.lang.Cloneable, java.lang.Comparable<CMObject>
Direct Known Subclasses:
CaveGrid, DesertGrid, EndlessOcean, EndlessSky, GreatLake, HillsGrid, JungleGrid, MountainsGrid, MountainSurfaceGrid, PlainsGrid, RoadGrid, StdMaze, StoneGrid, SwampGrid, UnderWaterGrid, WoodRoomGrid, WoodsGrid

public class StdGrid
extends StdRoom
implements GridLocale


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.planet_ink.coffee_mud.Locales.interfaces.GridLocale
GridLocale.ThinGridEntry, GridLocale.ThinGridEntryConverter
 
Nested classes/interfaces inherited from interface com.planet_ink.coffee_mud.core.interfaces.ItemPossessor
ItemPossessor.Expire, ItemPossessor.Find, ItemPossessor.Move
 
Nested classes/interfaces inherited from interface com.planet_ink.coffee_mud.Areas.interfaces.GridZones
GridZones.XYVector
 
Field Summary
protected  java.lang.String[] descriptions
           
protected  java.lang.String[] displayTexts
           
protected  SVector<WorldMap.CrossExit> gridexits
           
protected  Room[][] subMap
           
protected  int xsize
           
protected  int ysize
           
 
Fields inherited from class com.planet_ink.coffee_mud.Locales.StdRoom
affects, amDestroyed, basePhyStats, behaviors, cachedImageName, contents, description, displayText, doors, exits, expirationDate, gridParent, inhabitants, mobility, myArea, myID, myResource, name, phyStats, rawImageName, resourceFound, scripts, skyedYet, STDCODES, tickStatus, xtraValues
 
Fields inherited from interface com.planet_ink.coffee_mud.Locales.interfaces.Room
CONDITION_COLD, CONDITION_HOT, CONDITION_NORMAL, CONDITION_WET, DOMAIN_INDOORS_AIR, DOMAIN_INDOORS_CAVE, DOMAIN_INDOORS_MAGIC, DOMAIN_INDOORS_METAL, DOMAIN_INDOORS_STONE, DOMAIN_INDOORS_UNDERWATER, DOMAIN_INDOORS_WATERSURFACE, DOMAIN_INDOORS_WOOD, DOMAIN_OUTDOORS_AIR, DOMAIN_OUTDOORS_CITY, DOMAIN_OUTDOORS_DESERT, DOMAIN_OUTDOORS_HILLS, DOMAIN_OUTDOORS_JUNGLE, DOMAIN_OUTDOORS_MOUNTAINS, DOMAIN_OUTDOORS_PLAINS, DOMAIN_OUTDOORS_ROCKS, DOMAIN_OUTDOORS_SPACEPORT, DOMAIN_OUTDOORS_SWAMP, DOMAIN_OUTDOORS_UNDERWATER, DOMAIN_OUTDOORS_WATERSURFACE, DOMAIN_OUTDOORS_WOODS, indoorDomainDescs, INDOORS, outdoorDomainDescs, VARIATION_CODES, VARIATION_CODES_HASHED
 
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
 
Constructor Summary
StdGrid()
           
 
Method Summary
 void addOuterExit(WorldMap.CrossExit x)
           
protected  Room alternativeLink(Room room, Room defaultRoom, int dir)
           
protected  void buildFinalLinks()
           
 void buildGrid()
           
 void clearGrid(Room backHere)
           
protected  void cloneFix(Room E)
           
 void delOuterExit(WorldMap.CrossExit x)
           
 void destroy()
          Utterly and permanently destroy this object, not only removing it from the map, but causing this object to be collected as garbage by Java.
 void fillInTheExtraneousExternals(Room[][] subMap, Exit ox)
           
protected  Room findCenterRoom(int dirCode)
           
 java.util.List<Room> getAllRooms()
           
 Room getAltRoomFrom(Room loc, int direction)
           
protected  Room[][] getBuiltGrid()
           
 java.util.Iterator<Room> getExistingRooms()
           
 Room getGridChild(GridZones.XYVector xy)
          Returns the Room object at the given coordinates.
 Room getGridChild(int x, int y)
          Returns the Room object at the given coordinates.
 Room getGridChild(java.lang.String childCode)
          Returns the fully-qualified Room ID of this room
 java.lang.String getGridChildCode(Room loc)
          Returns the fully-qualified Room ID of this room
 java.lang.String getGridChildLocaleID()
           
 int getGridChildX(Room loc)
          Returns the X coordinate of the given Room object
 int getGridChildY(Room loc)
          Returns the Y coordinate of the given Room object
protected  Room getGridRoom(int x, int y)
           
 Room getRandomGridChild()
          Returns a random Room object that is a child of this one.
 GridZones.XYVector getRoomXY(Room room)
          Returns the XY coordinates of the Room, if a child of this gridzone, in XYVector format.
 GridZones.XYVector getRoomXY(java.lang.String roomID)
          Returns the XY coordinates of the Room with the given roomID in XYVector format.
 java.lang.String getStat(java.lang.String code)
          An alternative means of retreiving the values of those fields on this object which are modifiable at run-time by builders.
 java.lang.String[] getStatCodes()
          Returns an array of the string names of those fields which are modifiable on this object at run-time by builders.
protected  int getStdGridCodeNum(java.lang.String code)
           
protected  void halfLink(Room room, Room loc, int dirCode, Exit o)
           
 java.lang.String ID()
          The CoffeeMud Java Class ID shared by all instances of this object.
protected  int[] initCenterRoomAdjustsXY(int dirCode)
           
protected  int[] initCenterRoomXY(int dirCode)
           
 boolean isMyGridChild(Room loc)
          Returns whether the given Room is a child of this particular Grid instance.
protected  void linkRoom(Room room, Room loc, int dirCode, Exit o, Exit ao)
           
 CMObject newInstance()
          Returns a new instance of this class.
 boolean okMessage(Environmental myHost, CMMsg msg)
          The general message event previewer for the object.
 java.util.Iterator<WorldMap.CrossExit> outerExits()
           
 Room prepareGridLocale(Room fromRoom, Room toRoom, int direction)
           
 Room prepareRoomInDir(Room fromRoom, int direction)
           
 void setDescription(java.lang.String newDescription)
          Sets the basic description of this object, as shown when the item is directly LOOKed at.
 void setDisplayText(java.lang.String newDisplayText)
          Sets the raw string used to show what this object looks like in the room.
 void setStat(java.lang.String code, java.lang.String val)
          An alternative means of setting the values of those fields on this object which are modifiable at run-time by builders.
 void setXGridSize(int x)
          Sets the total width of this grid.
 void setYGridSize(int y)
          Sets the total height of this grid.
 void tryFillInExtraneousExternal(WorldMap.CrossExit EX, Exit ox)
           
 int xGridSize()
          Returns the total width of this grid.
 int yGridSize()
          Returns the total height of this grid
 
Methods inherited from class com.planet_ink.coffee_mud.Locales.StdRoom
addBehavior, addEffect, addInhabitant, addItem, addItem, addNonUninvokableEffect, addScript, affectCharState, affectCharStats, affectPhyStats, amDestroyed, basePhyStats, baseThirst, behaviors, bringMobHere, clearSky, compareTo, copyOf, delBehavior, delEffect, delInhabitant, delItem, delScript, description, displayText, domainConditions, domainType, effects, executeMsg, expirationDate, fetchBehavior, fetchBehavior, fetchEffect, fetchEffect, fetchFromMOBRoomFavorsItems, fetchFromMOBRoomFavorsMOBs, fetchFromMOBRoomItemExit, fetchFromRoomFavorItems, fetchFromRoomFavorMOBs, fetchInhabitant, fetchInhabitant, fetchInhabitants, fetchPCInhabitant, fetchScript, findItem, findItem, findItems, findItems, getArea, getCodeNum, getContextName, getExitInDir, getGridParent, getItem, getMobility, getPairedExit, getRawExit, getReverseExit, getRoomInDir, getSaveStatIndex, getTickStatus, giveASky, herbTwistChart, image, inhabitants, initializeClass, isContent, isGeneric, isHere, isInhabitant, isSameRoom, isSavable, isStat, items, maxRange, minRange, miscTextFormat, moveItemTo, moveItemTo, myResource, name, Name, numBehaviors, numEffects, numInhabitants, numItems, numPCInhabitants, numScripts, parseVaries, parseVariesCodes, phyStats, pointsPerMove, rawDoors, rawImage, reallyReallySend, reallySend, recoverPhyStats, recoverRoomStats, resourceChoices, roomDescription, roomID, roomTitle, sameAs, scripts, send, sendOthers, setArea, setBasePhyStats, setExpirationDate, setGridParent, setImage, setMiscText, setName, setRawExit, setResource, setRoomID, setSavable, show, show, show, show, show, showHappens, showHappens, showOthers, showOthers, showSource, showSource, startItemRejuv, text, thirstPerRound, tick, toggleMobility
 
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.Locales.interfaces.Room
addInhabitant, bringMobHere, clearSky, delInhabitant, domainConditions, domainType, fetchFromMOBRoomFavorsItems, fetchFromMOBRoomFavorsMOBs, fetchFromMOBRoomItemExit, fetchFromRoomFavorItems, fetchFromRoomFavorMOBs, fetchInhabitant, fetchInhabitant, fetchInhabitants, fetchPCInhabitant, getArea, getContextName, getExitInDir, getGridParent, getMobility, getPairedExit, getRawExit, getReverseExit, getRoomInDir, giveASky, inhabitants, isHere, isInhabitant, isSameRoom, myResource, numInhabitants, numPCInhabitants, pointsPerMove, rawDoors, recoverRoomStats, resourceChoices, roomDescription, roomID, roomTitle, send, sendOthers, setArea, setGridParent, setRawExit, setResource, setRoomID, show, show, show, show, show, showHappens, showHappens, showOthers, showOthers, showSource, showSource, startItemRejuv, thirstPerRound, toggleMobility
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.ItemPossessor
addItem, addItem, delItem, findItem, findItem, findItems, findItems, getItem, isContent, items, moveItemTo, moveItemTo, numItems
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Environmental
description, displayText, expirationDate, image, isGeneric, maxRange, minRange, miscTextFormat, name, Name, rawImage, sameAs, setExpirationDate, setImage, setMiscText, setName, text
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Tickable
getTickStatus, tick
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.StatsAffecting
affectCharState, affectCharStats, affectPhyStats
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.MsgListener
executeMsg
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Contingent
amDestroyed, isSavable, setSavable
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CMObject
copyOf, initializeClass
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Modifiable
getSaveStatIndex, isStat
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Affectable
addEffect, addNonUninvokableEffect, basePhyStats, delEffect, effects, fetchEffect, fetchEffect, numEffects, phyStats, recoverPhyStats, setBasePhyStats
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Behavable
addBehavior, addScript, behaviors, delBehavior, delScript, fetchBehavior, fetchBehavior, fetchScript, numBehaviors, numScripts, scripts
 

Field Detail

subMap

protected Room[][] subMap

descriptions

protected java.lang.String[] descriptions

displayTexts

protected java.lang.String[] displayTexts

gridexits

protected SVector<WorldMap.CrossExit> gridexits

xsize

protected int xsize

ysize

protected int ysize
Constructor Detail

StdGrid

public StdGrid()
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 StdRoom
Returns:
the name of this class

cloneFix

protected void cloneFix(Room E)
Overrides:
cloneFix in class StdRoom

getGridChildLocaleID

public java.lang.String getGridChildLocaleID()
Specified by:
getGridChildLocaleID in interface GridLocale

getGridChild

public Room getGridChild(GridZones.XYVector xy)
Description copied from interface: GridZones
Returns the Room object at the given coordinates.

Specified by:
getGridChild in interface GridZones
Parameters:
xy - the x and y coordinate
Returns:
the Room object at those coordinates
See Also:
Room, GridZones.XYVector

newInstance

public CMObject newInstance()
Description copied from interface: CMObject
Returns a new instance of this class.

Specified by:
newInstance in interface CMObject
Overrides:
newInstance in class StdRoom
Returns:
a new instance of this class

destroy

public void destroy()
Description copied from interface: Contingent
Utterly and permanently destroy this object, not only removing it from the map, but causing this object to be collected as garbage by Java. Containers, rooms. and mobs who have their destroy() method called will also call the destroy() methods on all items and other objects listed as content, recursively.

Specified by:
destroy in interface Contingent
Overrides:
destroy in class StdRoom

xGridSize

public int xGridSize()
Description copied from interface: GridZones
Returns the total width of this grid.

Specified by:
xGridSize in interface GridZones
Returns:
the width

yGridSize

public int yGridSize()
Description copied from interface: GridZones
Returns the total height of this grid

Specified by:
yGridSize in interface GridZones
Returns:
the height

setXGridSize

public void setXGridSize(int x)
Description copied from interface: GridZones
Sets the total width of this grid.

Specified by:
setXGridSize in interface GridZones
Parameters:
x - the width

setYGridSize

public void setYGridSize(int y)
Description copied from interface: GridZones
Sets the total height of this grid.

Specified by:
setYGridSize in interface GridZones
Parameters:
y - the height

getRoomXY

public GridZones.XYVector getRoomXY(java.lang.String roomID)
Description copied from interface: GridZones
Returns the XY coordinates of the Room with the given roomID in XYVector format.

Specified by:
getRoomXY in interface GridZones
Parameters:
roomID - the roomID of the room to get coordinates for
Returns:
coordinates in XYVector format.
See Also:
GridZones.XYVector

getRoomXY

public GridZones.XYVector getRoomXY(Room room)
Description copied from interface: GridZones
Returns the XY coordinates of the Room, if a child of this gridzone, in XYVector format.

Specified by:
getRoomXY in interface GridZones
Parameters:
room - the room to get coordinates for
Returns:
coordinates in XYVector format.
See Also:
GridZones.XYVector

prepareRoomInDir

public Room prepareRoomInDir(Room fromRoom,
                             int direction)
Specified by:
prepareRoomInDir in interface Room
Overrides:
prepareRoomInDir in class StdRoom

prepareGridLocale

public Room prepareGridLocale(Room fromRoom,
                              Room toRoom,
                              int direction)
Specified by:
prepareGridLocale in interface GridLocale

setDescription

public void setDescription(java.lang.String newDescription)
Description copied from interface: Environmental
Sets the basic description of this object, as shown when the item is directly LOOKed at.

Specified by:
setDescription in interface Environmental
Overrides:
setDescription in class StdRoom
Parameters:
newDescription - the basic detail description of this object

setDisplayText

public void setDisplayText(java.lang.String newDisplayText)
Description copied from interface: Environmental
Sets the raw string used to show what this object looks like in the room. May be used as a basis for other methods, such as the title of rooms, and what an exit looks like when open. The value for Items may be null if the item is not displayed when the room is seen.

Specified by:
setDisplayText in interface Environmental
Overrides:
setDisplayText in class StdRoom
Parameters:
newDisplayText - the string describing how this object looks in the room

outerExits

public java.util.Iterator<WorldMap.CrossExit> outerExits()
Specified by:
outerExits in interface GridLocale

addOuterExit

public void addOuterExit(WorldMap.CrossExit x)
Specified by:
addOuterExit in interface GridLocale

delOuterExit

public void delOuterExit(WorldMap.CrossExit x)
Specified by:
delOuterExit in interface GridLocale

getAltRoomFrom

public Room getAltRoomFrom(Room loc,
                           int direction)

getBuiltGrid

protected Room[][] getBuiltGrid()

getRandomGridChild

public Room getRandomGridChild()
Description copied from interface: GridZones
Returns a random Room object that is a child of this one.

Specified by:
getRandomGridChild in interface GridZones
Returns:
a Room object
See Also:
Room

getAllRooms

public java.util.List<Room> getAllRooms()
Specified by:
getAllRooms in interface GridLocale

getExistingRooms

public final java.util.Iterator<Room> getExistingRooms()
Specified by:
getExistingRooms in interface GridLocale

halfLink

protected void halfLink(Room room,
                        Room loc,
                        int dirCode,
                        Exit o)

alternativeLink

protected Room alternativeLink(Room room,
                               Room defaultRoom,
                               int dir)

linkRoom

protected void linkRoom(Room room,
                        Room loc,
                        int dirCode,
                        Exit o,
                        Exit ao)

initCenterRoomXY

protected int[] initCenterRoomXY(int dirCode)

initCenterRoomAdjustsXY

protected int[] initCenterRoomAdjustsXY(int dirCode)

findCenterRoom

protected Room findCenterRoom(int dirCode)

buildFinalLinks

protected void buildFinalLinks()

tryFillInExtraneousExternal

public void tryFillInExtraneousExternal(WorldMap.CrossExit EX,
                                        Exit ox)

fillInTheExtraneousExternals

public void fillInTheExtraneousExternals(Room[][] subMap,
                                         Exit ox)

buildGrid

public void buildGrid()
Specified by:
buildGrid in interface GridLocale

isMyGridChild

public boolean isMyGridChild(Room loc)
Description copied from interface: GridZones
Returns whether the given Room is a child of this particular Grid instance.

Specified by:
isMyGridChild in interface GridZones
Parameters:
loc - a Room object
Returns:
whether the room is a child
See Also:
Room

clearGrid

public void clearGrid(Room backHere)
Specified by:
clearGrid in interface GridLocale

getGridChildCode

public java.lang.String getGridChildCode(Room loc)
Description copied from interface: GridZones
Returns the fully-qualified Room ID of this room

Specified by:
getGridChildCode in interface GridZones
Parameters:
loc - a Room object
Returns:
a fully qualified room ID
See Also:
Room, GridZones.getGridChild(String)

getGridChildX

public int getGridChildX(Room loc)
Description copied from interface: GridZones
Returns the X coordinate of the given Room object

Specified by:
getGridChildX in interface GridZones
Parameters:
loc - the Room object
Returns:
the x coordinate of the room
See Also:
Room

getGridChildY

public int getGridChildY(Room loc)
Description copied from interface: GridZones
Returns the Y coordinate of the given Room object

Specified by:
getGridChildY in interface GridZones
Parameters:
loc - the Room object
Returns:
the y coordinate of the room
See Also:
Room

getGridChild

public Room getGridChild(java.lang.String childCode)
Description copied from interface: GridZones
Returns the fully-qualified Room ID of this room

Specified by:
getGridChild in interface GridZones
Parameters:
childCode - a fully-qualified Room ID for this Room
Returns:
a Room object
See Also:
Room, GridZones.getGridChildCode(Room)

getGridChild

public Room getGridChild(int x,
                         int y)
Description copied from interface: GridZones
Returns the Room object at the given coordinates.

Specified by:
getGridChild in interface GridZones
Parameters:
x - the x coordinate
y - the y coordinate
Returns:
the Room object at those coordinates
See Also:
Room

getGridRoom

protected Room getGridRoom(int x,
                           int y)

okMessage

public boolean okMessage(Environmental myHost,
                         CMMsg msg)
Description copied from interface: MsgListener
The general message event previewer for the object. Messages passed herein are in a pending state, and may be safely modified or rejected without fear that they might be in the middle of being executed. Messages passed herein may not necessarily be FOR or FROM this object, but will almost always represent events which want to happen in the same rom. This method should always always return true UNLESS this message needs to be canceled, in which case it is necessary to tell the mob initiating the event (CMMsg.source()) why it is being cancelled. Every game event goes through these methods.

Specified by:
okMessage in interface MsgListener
Overrides:
okMessage in class StdRoom
Parameters:
myHost - either the initiator of the event, or the host of this object
msg - the CMMsg that wants to be executed
Returns:
whether this message is allowed to execute
See Also:
CMMsg, CMMsg.source()

getStat

public java.lang.String getStat(java.lang.String code)
Description copied from interface: Modifiable
An alternative means of retreiving the values of those fields on this object which are modifiable at run-time by builders. See getStatCodes() for possible values for the code passed to this method. Values returned are always strings, even if the field itself is numeric or a list.

Specified by:
getStat in interface Modifiable
Overrides:
getStat in class StdRoom
Parameters:
code - the name of the field to read.
Returns:
the value of the field read
See Also:
Modifiable.getStatCodes()

setStat

public void setStat(java.lang.String code,
                    java.lang.String val)
Description copied from interface: Modifiable
An alternative means of setting the values of those fields on this object which are modifiable at run-time by builders. See getStatCodes() for possible values for the code passed to this method. The value passed in is always a string, even if the field itself is numeric or a list.

Specified by:
setStat in interface Modifiable
Overrides:
setStat in class StdRoom
Parameters:
code - the name of the field to set
val - the value to set the field to
See Also:
Modifiable.getStatCodes()

getStdGridCodeNum

protected int getStdGridCodeNum(java.lang.String code)

getStatCodes

public java.lang.String[] getStatCodes()
Description copied from interface: Modifiable
Returns an array of the string names of those fields which are modifiable on this object at run-time by builders.

Specified by:
getStatCodes in interface Modifiable
Overrides:
getStatCodes in class StdRoom
Returns:
list of the fields which may be set.
See Also:
Modifiable.getStat(String), Modifiable.setStat(String, String)