com.planet_ink.coffee_mud.MOBS.interfaces
Interface PostOffice

All Superinterfaces:
java.lang.Cloneable, CMObject, java.lang.Comparable<CMObject>, Contingent, Economics, Environmental, Modifiable, MsgListener, ShopKeeper, StatsAffecting, Tickable
All Known Implementing Classes:
GenPostman, StdPostman

public interface PostOffice
extends ShopKeeper

A PostOffice is a kind of shopkeeper that belongs to a "chain" which shares access to a common store of post office boxes to hold items for players. Post officers simulate delivery by transferring the items given to them into the appropriate boxes. Players must then go to a post office in the same chain to retrieve items delivered to them. Post offices can serve an entire clan, or a single player. They can handle several different types of charges, including COD.


Nested Class Summary
static class PostOffice.MailPiece
          Represents a complete mail package/letter, postal object.
 
Nested classes/interfaces inherited from interface com.planet_ink.coffee_mud.core.interfaces.ShopKeeper
ShopKeeper.ShopPrice
 
Field Summary
 
Fields inherited from interface com.planet_ink.coffee_mud.core.interfaces.ShopKeeper
DEAL_ALCHEMIST, DEAL_ANYTECHNOLOGY, DEAL_ANYTHING, DEAL_ARMOR, DEAL_AUCTIONEER, DEAL_BANKER, DEAL_BOOKS, DEAL_BUTCHER, DEAL_CASTER, DEAL_CLANBANKER, DEAL_CLANDSELLER, DEAL_CLANPOSTMAN, DEAL_CONFLICTS, DEAL_CSHIPSELLER, DEAL_DESCS, DEAL_FOODSELLER, DEAL_GENERAL, DEAL_GROWER, DEAL_HIDESELLER, DEAL_INNKEEPER, DEAL_INSTRUMENTS, DEAL_INVENTORYONLY, DEAL_JEWELLER, DEAL_LANDSELLER, DEAL_LEATHER, DEAL_LUMBERER, DEAL_MAGIC, DEAL_METALSMITH, DEAL_PETS, DEAL_POSTMAN, DEAL_READABLES, DEAL_SHIPSELLER, DEAL_SLAVES, DEAL_STONEYARDER, DEAL_TRAINER, DEAL_WEAPONS
 
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_BEAMWEAPON, TICKID_CLAN, TICKID_CLANITEM, TICKID_DEADBODY_DECAY, TICKID_ELECTRONICS, TICKID_EMAIL, 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_SOLITARYMASK, TICKID_SPECIALCOMBAT, TICKID_SPECIALMANEUVER, TICKID_SPELL_AFFECT, TICKID_SUPPORT, TICKID_TIMEAUCTION, TICKID_TRAP_DESTRUCTION, TICKID_TRAP_RESET
 
Method Summary
 void addToBox(java.lang.String boxName, Item thisThang, java.lang.String from, java.lang.String to, long holdTime, double COD)
          Low level method to add an item directly to a postal box.
 void createBoxHere(java.lang.String boxName, java.lang.String forward)
          Creates a new post office box for the given player or clan name, with the given forwarding address.
 void deleteBoxHere(java.lang.String boxName)
          Removes the given post office box for the given player or clan name.
 boolean delFromBox(java.lang.String boxName, Item thisThang)
          Low level method to remove an item from a postal box
 void emptyBox(java.lang.String boxName)
          Removes all items from the given post office box
 double feeForNewBox()
          Gets the fee to open a new postal box at this branch.
 Item findBoxContents(java.lang.String boxName, java.lang.String likeThis)
          Searches the given postal box for an item with the given name, or one with the given string as a substring.
 java.lang.String findProperBranch(java.lang.String name)
          Returns the proper branch of this postal chain to which to deliver packages belonging to the given mob or clan name.
 java.util.Map<java.lang.String,java.lang.String> getOurOpenBoxes(java.lang.String boxName)
          Returns a mapping of postal branches in this chain to forwarding addresses, for the given postal box.
 java.lang.String getSenderName(MOB mob, Clan.Function func, boolean checked)
          When the given mob tries to send or withdraw a package, this method is called to get the proper FROM address, which is either the mob themselves or their clan, if they are (optionally) permitted by their rank.
 double holdFeePerPound()
          Gets the fee charged per pound per mud month to hold a package in a postal box at this branch.
 int maxMudMonthsHeld()
          Returns the maximum number of mud-months that a package will be held before it gets put on sale at this branch.
 double minimumPostage()
          Gets the minimum postage to send a package from this branch.
 PostOffice.MailPiece parsePostalItemData(java.lang.String data)
          Parses an postal package entry, which is formatted as item xml preceded by various semicolon-delimited numbers and data.
 double postagePerPound()
          Gets the postage charged per pound after the first, to send packages from this branch.
 java.lang.String postalBranch()
          Returns the branch of the postal chain that this specific postoffice employee belongs to.
 java.lang.String postalChain()
          Returns the postal chain, a string shared by all post offices that deal with the same postal boxes and customers, able to send mail to each other.
 void setFeeForNewBox(double d)
          Sets the fee to open a new postal box at this branch.
 void setHoldFeePerPound(double d)
          Sets the fee charged per pound per mud month to hold a package in a postal box at this branch.
 void setMaxMudMonthsHeld(int months)
          Sets the maximum number of mud-months that a package will be held before it gets put on sale at this branch.
 void setMinimumPostage(double d)
          Sets the minimum postage to send a package from this branch.
 void setPostagePerPound(double d)
          Sets the postage charged per pound after the first, to send packages from this branch.
 void setPostalChain(java.lang.String name)
          Sets the postal chain, a string shared by all post offices that deal with the same postal boxes and customers, able to send mail to each other.
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.ShopKeeper
addSoldType, doISellThis, getShop, getWhatIsSoldMask, getWhatIsSoldZappermask, isSold, setWhatIsSoldMask, setWhatIsSoldZappermask, storeKeeperString
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Economics
budget, devalueRate, finalBudget, finalDevalueRate, finalIgnoreMask, finalInvResetRate, finalItemPricingAdjustments, finalPrejudiceFactors, ignoreMask, invResetRate, itemPricingAdjustments, prejudiceFactors, setBudget, setDevalueRate, setIgnoreMask, setInvResetRate, setItemPricingAdjustments, setPrejudiceFactors
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Environmental
description, displayText, expirationDate, image, isGeneric, L, maxRange, minRange, miscTextFormat, Name, rawImage, sameAs, setDescription, setDisplayText, setExpirationDate, setImage, setMiscText, setName, text
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Tickable
getTickStatus, name, 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, okMessage
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Contingent
amDestroyed, destroy, isSavable, setSavable
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CMObject
copyOf, ID, initializeClass, newInstance
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Modifiable
getSaveStatIndex, getStat, getStatCodes, isStat, setStat
 

Method Detail

getSenderName

java.lang.String getSenderName(MOB mob,
                               Clan.Function func,
                               boolean checked)
When the given mob tries to send or withdraw a package, this method is called to get the proper FROM address, which is either the mob themselves or their clan, if they are (optionally) permitted by their rank. If checked is true, and the mob does NOT have clan privileges, then an error message is given to the mob and null is returned.

Parameters:
mob - the mob who is trying to send the package
func - either Clan.Function.WITHDRAW or Clan.FUNCTION.DEPOSIT
checked - true if the mob must have clan privileges, false if not.
Returns:
the mobs name, their clan name, or null
See Also:
Clan.Function

addToBox

void addToBox(java.lang.String boxName,
              Item thisThang,
              java.lang.String from,
              java.lang.String to,
              long holdTime,
              double COD)
Low level method to add an item directly to a postal box.

Parameters:
boxName - the box name, such as a player or clan name
thisThang - the item to add to the postal box
from - player or clan the item is from
to - player or clan the item is to
holdTime - when the package was sent, real time, in milliseconds
COD - the amount of money which must be paid to withdraw the item
See Also:
delFromBox(String, Item), emptyBox(String)

delFromBox

boolean delFromBox(java.lang.String boxName,
                   Item thisThang)
Low level method to remove an item from a postal box

Parameters:
boxName - the box name, such as a player or clan name
thisThang - the item to remove from the postal box
Returns:
true if the item was removed, or false otherwise
See Also:
addToBox(String, Item, String, String, long, double), emptyBox(String)

emptyBox

void emptyBox(java.lang.String boxName)
Removes all items from the given post office box

Parameters:
boxName - the box name, such as a player or clan name
See Also:
addToBox(String, Item, String, String, long, double), delFromBox(String, Item)

findBoxContents

Item findBoxContents(java.lang.String boxName,
                     java.lang.String likeThis)
Searches the given postal box for an item with the given name, or one with the given string as a substring.

Parameters:
boxName - the player or clan name of the postal box
likeThis - the search string for the item name
Returns:
the item found, or null

getOurOpenBoxes

java.util.Map<java.lang.String,java.lang.String> getOurOpenBoxes(java.lang.String boxName)
Returns a mapping of postal branches in this chain to forwarding addresses, for the given postal box.

Parameters:
boxName - the player or clan name of the box
Returns:
a mapping of postal branches to forwarding addresses.
See Also:
deleteBoxHere(String), createBoxHere(String, String)

createBoxHere

void createBoxHere(java.lang.String boxName,
                   java.lang.String forward)
Creates a new post office box for the given player or clan name, with the given forwarding address.

Parameters:
boxName - the player or clan name of the new box
forward - the player or clan name of the forwarding
See Also:
deleteBoxHere(String), getOurOpenBoxes(String)

deleteBoxHere

void deleteBoxHere(java.lang.String boxName)
Removes the given post office box for the given player or clan name.

Parameters:
boxName - the player or clan name of the new box
See Also:
createBoxHere(String, String), getOurOpenBoxes(String)

parsePostalItemData

PostOffice.MailPiece parsePostalItemData(java.lang.String data)
Parses an postal package entry, which is formatted as item xml preceded by various semicolon-delimited numbers and data.

Parameters:
data - the postal package formatted string
Returns:
the MailPiece object
See Also:
PostOffice.MailPiece

postalChain

java.lang.String postalChain()
Returns the postal chain, a string shared by all post offices that deal with the same postal boxes and customers, able to send mail to each other.

Returns:
the name of the postal chain
See Also:
setPostalChain(String)

setPostalChain

void setPostalChain(java.lang.String name)
Sets the postal chain, a string shared by all post offices that deal with the same postal boxes and customers, able to send mail to each other.

Parameters:
name - the name of the postal chain
See Also:
postalChain()

postalBranch

java.lang.String postalBranch()
Returns the branch of the postal chain that this specific postoffice employee belongs to. Typically the extended room id, this is a unique identifier for this branch of the postal chain. Each PostOffice should be unique!

Returns:
the branch of the postal chain
See Also:
findProperBranch(String)

findProperBranch

java.lang.String findProperBranch(java.lang.String name)
Returns the proper branch of this postal chain to which to deliver packages belonging to the given mob or clan name.

Parameters:
name - the player or clan name receiving the package
Returns:
the best branch in this postal chain to deliver to
See Also:
postalBranch()

minimumPostage

double minimumPostage()
Gets the minimum postage to send a package from this branch.

Returns:
the minimum postage to send a package from this branch.
See Also:
setMinimumPostage(double)

setMinimumPostage

void setMinimumPostage(double d)
Sets the minimum postage to send a package from this branch.

Parameters:
d - the minimum postage to send a package from this branch.
See Also:
minimumPostage()

postagePerPound

double postagePerPound()
Gets the postage charged per pound after the first, to send packages from this branch.

Returns:
the postage charged per pound after the first
See Also:
setPostagePerPound(double)

setPostagePerPound

void setPostagePerPound(double d)
Sets the postage charged per pound after the first, to send packages from this branch.

Parameters:
d - the postage charged per pound after the first
See Also:
postagePerPound()

holdFeePerPound

double holdFeePerPound()
Gets the fee charged per pound per mud month to hold a package in a postal box at this branch.

Returns:
the fee charged per pound per mud month
See Also:
setHoldFeePerPound(double)

setHoldFeePerPound

void setHoldFeePerPound(double d)
Sets the fee charged per pound per mud month to hold a package in a postal box at this branch.

Parameters:
d - the fee charged per pound per mud month
See Also:
holdFeePerPound()

feeForNewBox

double feeForNewBox()
Gets the fee to open a new postal box at this branch.

Returns:
the fee to open a new postal box at this branch.
See Also:
setFeeForNewBox(double)

setFeeForNewBox

void setFeeForNewBox(double d)
Sets the fee to open a new postal box at this branch.

Parameters:
d - the fee to open a new postal box at this branch.
See Also:
feeForNewBox()

maxMudMonthsHeld

int maxMudMonthsHeld()
Returns the maximum number of mud-months that a package will be held before it gets put on sale at this branch.

Returns:
the maximum number of mud-months to hold
See Also:
setMaxMudMonthsHeld(int)

setMaxMudMonthsHeld

void setMaxMudMonthsHeld(int months)
Sets the maximum number of mud-months that a package will be held before it gets put on sale at this branch.

Parameters:
months - the maximum number of mud-months to hold
See Also:
setMaxMudMonthsHeld(int)