/[drupal]/contributions/modules/rpg/inc/rpg.hooks.php
ViewVC logotype

Diff of /contributions/modules/rpg/inc/rpg.hooks.php

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.10, Sat Mar 8 00:31:04 2008 UTC revision 1.11, Sat Apr 26 01:03:25 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: rpg.hooks.php,v 1.8 2007/12/06 22:52:43 aaron Exp $  // $Id: rpg.hooks.php,v 1.10 2008/03/08 00:31:04 aaron Exp $
3    
4  /**  /**
5   *  @file   *  @file
# Line 63  function hook_rpg_attribute_class_settin Line 63  function hook_rpg_attribute_class_settin
63   *  This hook is used to define what rpg types may be used as player characters for users to choose from.   *  This hook is used to define what rpg types may be used as player characters for users to choose from.
64   *   *
65   *  Typically used by Rulesets, but any module may use the hook. This is used primarily to create the lists   *  Typically used by Rulesets, but any module may use the hook. This is used primarily to create the lists
66   *  from /rpg/create/pc   *  from /rpg/create/pc.
67   *   *
68     *  @param $user
69     *    The user creating the PC. This may be used to limit the available PC types, according to the user's role access settings,
70     *    or other criteria, such as whether a user has achieved a certain quest with another character.
71   *  @return   *  @return
72   *    An array of types that may be used when creating pc's   *    An array of types that may be used when creating pc's
73   *   *
74   *  @ingroup hooks   *  @ingroup hooks
75   */   */
76  function hook_rpg_pc_types() {  function hook_rpg_pc_types($user) {
77    return array('human', 'robot', 'elf');    $current_pcs = rpg_user_pcs($user);
78      if (sizeof($current_pcs) >= 5 && !user_access('administer rpg')) {
79        // don't allow users more than 5 characters
80        return array();
81      }
82      $types = array('human', 'robot', 'elf' => 'elf');
83      if (user_access('super rpg')) {
84        $types[] = 'giant';
85      }
86      if (in_array('power gamer', $user->roles)) {
87        $types[] = 'vampire_cyborg';
88      }
89      foreach ($current_pcs as $pc) {
90        if (module_invoke('rpg_achieve', 'get', 'traversed_labrynth', $pc)) {
91          $types['minotaur'] = 'minotaur';
92        }
93        // only allow one elf per user
94        if (rpg_is_a($pc, 'elf')) {
95          unset($types['elf']);
96        }
97      }
98      return $types
99  }  }
100    
101  /**  /**

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.2