Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

cRPG_classes.RPGPlayerManip


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
//-----------------------------------------------------------
//          RPGPlayerManip                                   <br />
//                                                           <br />
//          Utility Class for manipulating the RPG Players
//          Temporary package untill more utilities are
//          created.                                         <br />
//                                                           <br />
//          Author: Continuum                                <br />
//
//-----------------------------------------------------------
class RPGPlayerManip  extends Object;


/**
   Cycle through pawns inventory and find the RPGPlayerDataObject in it,
   Return the RPGPlayerDataObject.
   <ul>
       <li>@param Pawn The pawn to look in.</li>
   </ul>

   <br />
   <b>Note</b><br />
   <i>The RPGPlayerDataObject that is returned from this method is initialized to
   none so check if it == none before using.</i>
*/
static function RPGPlayerDataObject getRPGPlayerData(Pawn p)
{


 local RPGStatsInv StatsInv;
 local RPGPlayerDataObject rpgPlayer;
 rpgPlayer = none;
 StatsInv = none;


 /*
   If no controller or not a player do not continue.
 */
 if (p.Controller == None || !p.Controller.bIsPlayer)
 {
  return none;
 }//if


 StatsInv = RPGStatsInv(p.FindInventoryType(class'RPGStatsInv'));//Find the RPGStatsInv object in the pawns inventory

 if (StatsInv != None)
 {
    rpgPlayer = StatsInv.DataObject;
 }

 return rpgPlayer;//check for null when calling



}//getRpgPlayerData()


/**
  Returns the level of an RPGPlayer.
  <ul>
      <li>@param p The pawn</li>
  </ul>
*/
static function int getRPGPlayerLvl(Pawn p)
{
       local RPGPlayerDataObject rpgPlayer;
       local int playerLvl;

       playerLvl = 0;
       rpgPlayer = getRPGPlayerData(p);
       if(rpgPlayer == none)
       {
        log("RPGPlayerManip.getRPGPlayerLvl() did not return a RPGPLayerDataObject!");
        return -1;
       }
       else
       {
        playerLvl = rpgPlayer.Level;
        return playerLvl;
       }

}//getRPGPlayerLvl()


/**
   Get the lvl of an ability.<br />
   <ul>
       <li>@param p Pawn wanting their ability lvl</li>
       <li>@param ability The ability that the lvl is needed for</li>
   </ul>
   <br />
   <i>Edit<br />
   No suitable static properties or functions could be used for this so this
   function no longer uses RPGAbility as the 2nd Parameter... RPGAbility needs
   a static name or id field for this to work properly.</i>
*/
static function int getRPGPlayerAbilityLvl(Pawn p, AbilityLimitBreak ability)
{
       local RPGPlayerDataObject rpgPlayer;
       local int abilityLvl;
       local int i;

       abilityLvl = 0;




       getRPGPlayerData(p);

       for(i = 0; i < rpgPlayer.Abilities.length; i++)
       {

       /*
         In the future re-write to be <br />
         if(rpgPlayer.Abilities.static.abilityName == abiliti.abilityName)
       */
        if(rpgPlayer.Abilities[i].class == ability.Class)
        {
           abilityLvl = rpgPlayer.AbilityLevels[i];
        }



       }

       return abilityLvl;

}//getRPGPLayerAbilityLvl()

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Sun 4/3/2007 21:29:16.000 - Creation time: Sun 4/3/2007 21:38:06.261 - Created with UnCodeX