com.planet_ink.coffee_mud.MOBS
Class StdPostman

java.lang.Object
  extended by com.planet_ink.coffee_mud.MOBS.StdMOB
      extended by com.planet_ink.coffee_mud.MOBS.StdShopKeeper
          extended by com.planet_ink.coffee_mud.MOBS.StdPostman
All Implemented Interfaces:
Affectable, Behavable, CMObject, Contingent, DBIdentifiable, Economics, Environmental, ItemPossessor, Modifiable, MsgListener, Physical, PhysicalAgent, Rider, ShopKeeper, StatsAffecting, Tickable, MOB, PostOffice, java.lang.Cloneable, java.lang.Comparable<CMObject>
Direct Known Subclasses:
GenPostman

public class StdPostman
extends StdShopKeeper
implements PostOffice


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.planet_ink.coffee_mud.MOBS.interfaces.PostOffice
PostOffice.MailPiece
 
Nested classes/interfaces inherited from interface com.planet_ink.coffee_mud.core.interfaces.ShopKeeper
ShopKeeper.ShopPrice
 
Nested classes/interfaces inherited from interface com.planet_ink.coffee_mud.MOBS.interfaces.MOB
MOB.Follower, MOB.QMCommand, MOB.Tattoo
 
Nested classes/interfaces inherited from interface com.planet_ink.coffee_mud.core.interfaces.ItemPossessor
ItemPossessor.Expire, ItemPossessor.Find, ItemPossessor.Move
 
Field Summary
protected  double feeForNewBox
           
protected  double holdFeePerPound
           
protected  int maxMudMonthsHeld
           
protected  double minimumPostage
           
protected  double postagePerPound
           
protected static java.util.Hashtable postalTimes
           
 
Fields inherited from class com.planet_ink.coffee_mud.MOBS.StdShopKeeper
budget, budgetMax, budgetRemaining, budgetTickDown, devalueRate, invResetRate, invResetTickDown, pricingAdjustments, shop, whatIsSoldMask
 
Fields inherited from class com.planet_ink.coffee_mud.MOBS.StdMOB
abilitys, affects, ageHours, amDead, amDestroyed, amFollowing, atRange, attributesBitmap, baseCharStats, basePhyStats, baseState, behaviors, cachedClan, cachedImageName, charStats, clanAffects, clanID, clanRole, CODES, commandQue, curState, databaseID, description, displayText, experience, expertises, factions, followers, imMobile, inventory, kickFlag, lastLocation, liegeID, location, maxState, miscText, money, moneyVariation, mySession, peaceTime, phyStats, playerStats, pleaseDestroy, possibleWeaponIndex, practices, questPoint, racialAffects, rawImageName, recoverTickCounter, riding, scripts, soulMate, startRoomPossibly, tattoos, tickCounter, tickStatus, trains, username, victim, wimpHitPoint, worshipCharID, xtraValues
 
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_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_INVENTORYONLY, DEAL_JEWELLER, DEAL_LANDSELLER, DEAL_LEATHER, DEAL_LUMBERER, DEAL_MAGIC, DEAL_METALSMITH, DEAL_PETS, DEAL_POSTMAN, 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_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
 
Fields inherited from interface com.planet_ink.coffee_mud.MOBS.interfaces.MOB
ATT_ANSI, ATT_AUTOASSIST, ATT_AUTODRAW, ATT_AUTOEXITS, ATT_AUTOFORWARD, ATT_AUTOGOLD, ATT_AUTOGUARD, ATT_AUTOIMPROVE, ATT_AUTOLOOT, ATT_AUTOMELEE, ATT_AUTONOTIFY, ATT_AUTORUN, ATT_AUTOWEATHER, ATT_BRIEF, ATT_COMPRESS, ATT_DAILYMESSAGE, ATT_MXP, ATT_NOFOLLOW, ATT_NOTEACH, ATT_PLAYERKILL, ATT_QUIET, ATT_SOUND, ATT_SYSOPMSGS, AUTODESC, AUTOREV, END_SHEATH_TIME, START_SHEATH_TIME
 
Constructor Summary
StdPostman()
           
 
Method Summary
 void addSoldType(int mask)
          Adds the ShopKeeper DEAL_* constants describing what is sold or bought by this ShopKeeper to the existing shopkeeper mask.
 void addToBox(MOB mob, Item thisThang, java.lang.String from, java.lang.String to, long holdTime, double COD)
           
 void addToBox(java.lang.String mob, Item thisThang, java.lang.String from, java.lang.String to, long holdTime, double COD)
           
 void autoGive(MOB src, MOB tgt, Item I)
           
 void createBoxHere(java.lang.String mob, java.lang.String forward)
           
 void deleteBoxHere(java.lang.String mob)
           
 boolean delFromBox(MOB mob, Item thisThang)
           
 boolean delFromBox(java.lang.String mob, Item thisThang)
           
 void emptyBox(java.lang.String mob)
           
 void executeMsg(Environmental myHost, CMMsg msg)
          The general message event handler for the object.
 double feeForNewBox()
           
 Item findBoxContents(MOB mob, java.lang.String likeThis)
           
 Item findBoxContents(java.lang.String mob, java.lang.String likeThis)
           
 PostOffice.MailPiece findExactBoxData(java.lang.String mob, Item likeThis)
           
 java.lang.String findProperBranch(java.lang.String toWhom)
           
 java.util.Vector getAllLocalBoxPD(java.lang.String mob)
           
 java.util.List<DatabaseEngine.PlayerData> getBoxRowPDData(java.lang.String mob)
           
protected  java.lang.String getBranchPostableTo(java.lang.String toWhom, java.lang.String branch, java.util.Map<java.lang.String,java.lang.String> allBranchBoxes)
           
protected  int getChargeableWeight(Item I)
           
protected  double getCODChargeForPiece(PostOffice.MailPiece data)
           
protected  double getHoldingCost(PostOffice.MailPiece data, int chargeableWeight)
           
 java.util.Map<java.lang.String,java.lang.String> getOurOpenBoxes(java.lang.String mob)
           
protected  double getSimplePostage(int chargeableWeight)
           
 double holdFeePerPound()
           
 java.lang.String ID()
          The CoffeeMud Java Class ID shared by all instances of this object.
protected  Item makeItem(PostOffice.MailPiece data)
           
 int maxMudMonthsHeld()
           
 double minimumPostage()
           
 boolean okMessage(Environmental myHost, CMMsg msg)
          The general message event previewer for the object.
 PostOffice.MailPiece parsePostalItemData(java.lang.String data)
           
 double postagePerPound()
           
 java.lang.String postalBranch()
           
 java.lang.String postalChain()
           
 long postalWaitTime()
           
 void setFeeForNewBox(double d)
           
 void setHoldFeePerPound(double d)
           
 void setMaxMudMonthsHeld(int months)
           
 void setMinimumPostage(double d)
           
 void setPostagePerPound(double d)
           
 void setPostalChain(java.lang.String name)
           
 void setWhatIsSoldMask(long newSellCode)
          Sets the encoded ShopKeeper DEAL_* constants describing what is sold or bought by this ShopKeeper
 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.MOBS.StdShopKeeper
budget, cloneFix, devalueRate, doISellThis, finalBudget, finalDevalueRate, finalIgnoreMask, finalInvResetRate, finalItemPricingAdjustments, finalPrejudiceFactors, getShop, getStartArea, getWhatIsSoldMask, ignoreMask, invResetRate, isSold, itemPricingAdjustments, prejudiceFactors, setBudget, setDevalueRate, setIgnoreMask, setInvResetRate, setItemPricingAdjustments, setPrejudiceFactors, storeKeeperString
 
Methods inherited from class com.planet_ink.coffee_mud.MOBS.StdMOB
abilities, actions, addAbility, addBehavior, addEffect, addExpertise, addFaction, addFollower, addItem, addItem, addNonUninvokableEffect, addPriorityEffect, addScript, addTattoo, adjustFaction, affectCharState, affectCharStats, affectPhyStats, amActive, amDead, amDestroyed, amFollowing, amUltimatelyFollowing, baseCharStats, basePhyStats, baseState, baseWeight, behaviors, bringToLife, bringToLife, calculateTickDelay, canSaveDatabaseID, charStats, clanEffects, commandQueSize, compareTo, copyFactions, copyOf, curState, databaseID, delAbility, delBehavior, delEffect, delExpertise, delFollower, delItem, delScript, delTattoo, dequeCommand, description, destroy, displayName, displayText, displayText, dispossess, doCommand, doCommand, effects, enqueCommand, expirationDate, fetchAbility, fetchAbility, fetchBehavior, fetchBehavior, fetchCarried, fetchEffect, fetchEffect, fetchExpertise, fetchExpertise, fetchFaction, fetchFactionRanges, fetchFactions, fetchFirstWornItem, fetchFollower, fetchFollower, fetchFollowerOrder, fetchFromInventory, fetchScript, fetchWieldedItem, fetchWornItem, fetchWornItems, findAbility, findItem, findItem, findItems, findItems, findTattoo, flagVariableEq, followers, freeWearPositions, genericName, getAgeHours, getBitmap, getClanID, getClanRole, getCodeNum, getExperience, getExpNeededDelevel, getExpNeededLevel, getExpNextLevel, getExpPrevLevel, getFactionListing, getGroupMembers, getItem, getLiegeID, getMoney, getMoneyVariation, getMyClan, getMyDeity, getPractices, getQuestPoint, getRideBuddies, getSaveStatIndex, getStartRoom, getStat, getStatCodes, getTickStatus, getTrains, getVictim, getWearPositions, getWimpHitPoint, getWorshipCharID, hasFaction, hasOnlyGoldInInventory, healthText, image, initializeClass, isContent, isFollowedBy, isGeneric, isInCombat, isMarriedToLiege, isMine, isMonster, isPossessing, isSavable, isStat, items, killMeDead, lastTickedDateTime, location, makePeace, maxCarry, maxFollowers, maxItems, maxRange, maxRange, maxState, mayIFight, mayPhysicallyAttack, minRange, minRange, miscTextFormat, moveItemTo, moveItemTo, myNaturalWeapon, name, Name, newInstance, numAbilities, numAllEffects, numBehaviors, numEffects, numExpertises, numFollowers, numItems, numLearnedAbilities, numScripts, peaceTime, personalEffects, phyStats, playerStats, prequeCommand, racialEffects, rangeToTarget, rawImage, recoverCharStats, recoverMaxState, recoverPhyStats, removeFaction, removeFromGame, resetToMaxState, riding, sameAs, scripts, session, setActions, setAgeHours, setAtRange, setBaseCharStats, setBasePhyStats, setBaseState, setBitmap, setClanID, setClanRole, setDatabaseID, setDescription, setDisplayText, setExperience, setExpirationDate, setExpNextLevel, setFollowing, setImage, setLiegeID, setLocation, setMiscText, setMoney, setMoneyVariation, setName, setPlayerStats, setPractices, setQuestPoint, setRiding, setSavable, setSession, setSoulMate, setStartRoom, setStat, setTrains, setVictim, setWimpHitPoint, setWorshipCharID, soulMate, tattoos, tell, tell, text, titledName, totalFollowers, uniqueExpertises, willFollowOrdersOf
 
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.core.interfaces.ShopKeeper
doISellThis, getShop, getWhatIsSoldMask, isSold, 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, maxRange, minRange, miscTextFormat, name, Name, rawImage, sameAs, setDescription, setDisplayText, setExpirationDate, setImage, setMiscText, setName, text
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.Tickable
getTickStatus
 
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.Contingent
amDestroyed, destroy, isSavable, setSavable
 
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.Modifiable
getSaveStatIndex, getStat, getStatCodes, isStat, setStat
 

Field Detail

minimumPostage

protected double minimumPostage

postagePerPound

protected double postagePerPound

holdFeePerPound

protected double holdFeePerPound

feeForNewBox

protected double feeForNewBox

maxMudMonthsHeld

protected int maxMudMonthsHeld

postalTimes

protected static java.util.Hashtable postalTimes
Constructor Detail

StdPostman

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

minimumPostage

public double minimumPostage()
Specified by:
minimumPostage in interface PostOffice

setMinimumPostage

public void setMinimumPostage(double d)
Specified by:
setMinimumPostage in interface PostOffice

postagePerPound

public double postagePerPound()
Specified by:
postagePerPound in interface PostOffice

setPostagePerPound

public void setPostagePerPound(double d)
Specified by:
setPostagePerPound in interface PostOffice

holdFeePerPound

public double holdFeePerPound()
Specified by:
holdFeePerPound in interface PostOffice

setHoldFeePerPound

public void setHoldFeePerPound(double d)
Specified by:
setHoldFeePerPound in interface PostOffice

feeForNewBox

public double feeForNewBox()
Specified by:
feeForNewBox in interface PostOffice

setFeeForNewBox

public void setFeeForNewBox(double d)
Specified by:
setFeeForNewBox in interface PostOffice

maxMudMonthsHeld

public int maxMudMonthsHeld()
Specified by:
maxMudMonthsHeld in interface PostOffice

setMaxMudMonthsHeld

public void setMaxMudMonthsHeld(int months)
Specified by:
setMaxMudMonthsHeld in interface PostOffice

addSoldType

public void addSoldType(int mask)
Description copied from interface: ShopKeeper
Adds the ShopKeeper DEAL_* constants describing what is sold or bought by this ShopKeeper to the existing shopkeeper mask. A value of 0 will clear the whole mask.

Specified by:
addSoldType in interface ShopKeeper
Overrides:
addSoldType in class StdShopKeeper
Parameters:
mask - the ShopKeeper DEAL_* constants describing what is sold or bought by this ShopKeeper
See Also:
ShopKeeper.DEAL_DESCS, ShopKeeper.isSold(int)

setWhatIsSoldMask

public void setWhatIsSoldMask(long newSellCode)
Description copied from interface: ShopKeeper
Sets the encoded ShopKeeper DEAL_* constants describing what is sold or bought by this ShopKeeper

Specified by:
setWhatIsSoldMask in interface ShopKeeper
Overrides:
setWhatIsSoldMask in class StdShopKeeper
Parameters:
newSellCode - the dealer type constants to the 2nd power, shifted 8 bits left
See Also:
ShopKeeper.DEAL_DESCS, ShopKeeper.addSoldType(int)

postalChain

public java.lang.String postalChain()
Specified by:
postalChain in interface PostOffice

setPostalChain

public void setPostalChain(java.lang.String name)
Specified by:
setPostalChain in interface PostOffice

postalBranch

public java.lang.String postalBranch()
Specified by:
postalBranch in interface PostOffice

addToBox

public void addToBox(java.lang.String mob,
                     Item thisThang,
                     java.lang.String from,
                     java.lang.String to,
                     long holdTime,
                     double COD)
Specified by:
addToBox in interface PostOffice

addToBox

public void addToBox(MOB mob,
                     Item thisThang,
                     java.lang.String from,
                     java.lang.String to,
                     long holdTime,
                     double COD)
Specified by:
addToBox in interface PostOffice

delFromBox

public boolean delFromBox(MOB mob,
                          Item thisThang)
Specified by:
delFromBox in interface PostOffice

delFromBox

public boolean delFromBox(java.lang.String mob,
                          Item thisThang)
Specified by:
delFromBox in interface PostOffice

emptyBox

public void emptyBox(java.lang.String mob)
Specified by:
emptyBox in interface PostOffice

getOurOpenBoxes

public java.util.Map<java.lang.String,java.lang.String> getOurOpenBoxes(java.lang.String mob)
Specified by:
getOurOpenBoxes in interface PostOffice

createBoxHere

public void createBoxHere(java.lang.String mob,
                          java.lang.String forward)
Specified by:
createBoxHere in interface PostOffice

deleteBoxHere

public void deleteBoxHere(java.lang.String mob)
Specified by:
deleteBoxHere in interface PostOffice

getAllLocalBoxPD

public java.util.Vector getAllLocalBoxPD(java.lang.String mob)

getBoxRowPDData

public java.util.List<DatabaseEngine.PlayerData> getBoxRowPDData(java.lang.String mob)

findBoxContents

public Item findBoxContents(MOB mob,
                            java.lang.String likeThis)
Specified by:
findBoxContents in interface PostOffice

findBoxContents

public Item findBoxContents(java.lang.String mob,
                            java.lang.String likeThis)
Specified by:
findBoxContents in interface PostOffice

findExactBoxData

public PostOffice.MailPiece findExactBoxData(java.lang.String mob,
                                             Item likeThis)

parsePostalItemData

public PostOffice.MailPiece parsePostalItemData(java.lang.String data)
Specified by:
parsePostalItemData in interface PostOffice

makeItem

protected Item makeItem(PostOffice.MailPiece data)

getChargeableWeight

protected int getChargeableWeight(Item I)

getSimplePostage

protected double getSimplePostage(int chargeableWeight)

getHoldingCost

protected double getHoldingCost(PostOffice.MailPiece data,
                                int chargeableWeight)

getCODChargeForPiece

protected double getCODChargeForPiece(PostOffice.MailPiece data)

getBranchPostableTo

protected java.lang.String getBranchPostableTo(java.lang.String toWhom,
                                               java.lang.String branch,
                                               java.util.Map<java.lang.String,java.lang.String> allBranchBoxes)

findProperBranch

public java.lang.String findProperBranch(java.lang.String toWhom)
Specified by:
findProperBranch in interface PostOffice

postalWaitTime

public long postalWaitTime()

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
Overrides:
tick in class StdShopKeeper
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

autoGive

public void autoGive(MOB src,
                     MOB tgt,
                     Item I)

executeMsg

public void executeMsg(Environmental myHost,
                       CMMsg msg)
Description copied from interface: MsgListener
The general message event handler for the object. Messages passed herein may not necessarily be FOR this object, or from it, but will almost always represent events happening in the same room. The messages have already been through an approval process, so this method is called only to affect the final execution of the meaning of the message. Every game event goes through these methods.

Specified by:
executeMsg in interface MsgListener
Overrides:
executeMsg in class StdShopKeeper
Parameters:
myHost - either the initiator of the event, or the host of this object
msg - the CMMsg that needs to be executed
See Also:
CMMsg

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 StdShopKeeper
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()