hoa_global::GlobalItem Class Reference

Represents items found and used throughout the game. More...

#include <global_objects.h>

Inheritance diagram for hoa_global::GlobalItem:

Inheritance graph
[legend]
Collaboration diagram for hoa_global::GlobalItem:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void BattleUse (hoa_battle::private_battle::BattleActor *target, hoa_battle::private_battle::BattleActor *instigator)
 Calls the script function which performs the item's use for battle mode.
GLOBAL_OBJECT GetObjectType () const
 Purely virtual function used to distinguish between object types.
 GlobalItem (uint32 id, uint32 count=1)
bool IsUsableInBattle ()
 Returns true if the item can be used in battle mode.
bool IsUsableInMenu ()
 Returns true if the item can be used in menu mode.
void MenuUse (GlobalCharacter *target)
 Calls the script function which performs the item's use for menu mode.
 ~GlobalItem ()
Class Member Access Functions
GLOBAL_TARGET GetTargetType () const
GLOBAL_USE GetUsage () const
bool IsTargetAlly () const

Private Attributes

ScriptObject * _battle_use_function
 A pointer to the script function that performs the item's effect while in battle.
ScriptObject * _menu_use_function
 A pointer to the script function that performs the item's effect while in a menu.
bool _target_ally
 If true the item should target allies, otherwise it should target enemies.
GLOBAL_TARGET _target_type
 The type of target for the item. Target types include attack points, actors, and parties. This enum type is defined in global_skills.h.
GLOBAL_USE _usage
 Values to indicate where the item may be used Items may only be used in either menu mode or battle mode. If an item is to be used in another game mode, then it choose to use either the menu or battle use functions.

Detailed Description

Represents items found and used throughout the game.

****************************************************************************

This class is for "general" items such as healing potions. Each item has a different effect when it is used, which is implemented by a small Lua function written specifically for the item which calls it. Items may be used in only certain game modes (battles, menus, etc.). Most items can be used by any character, although some may only be used by certain characters.

Todo:
Item script functions should take abstract target type class pointers, not character or actor pointers.

Definition at line 188 of file global_objects.h.


Constructor & Destructor Documentation

hoa_global::GlobalItem::GlobalItem ( uint32  id,
uint32  count = 1 
)

Definition at line 65 of file global_objects.cpp.

References _battle_use_function, hoa_global::GlobalObject::_description, hoa_global::GlobalObject::_icon_image, hoa_global::GlobalObject::_id, hoa_global::GameGlobal::_items_script, _menu_use_function, hoa_global::GlobalObject::_name, hoa_global::GlobalObject::_price, _target_ally, _target_type, _usage, hoa_script::ReadScriptDescriptor::CloseTable(), hoa_script::ReadScriptDescriptor::DoesFunctionExist(), hoa_script::ReadScriptDescriptor::DoesTableExist(), hoa_script::ScriptDescriptor::GetErrorMessages(), hoa_global::GLOBAL_DEBUG, hoa_global::GLOBAL_USE_ALL, hoa_global::GLOBAL_USE_BATTLE, hoa_global::GLOBAL_USE_INVALID, hoa_global::GLOBAL_USE_MENU, hoa_global::GlobalManager, hoa_script::ScriptDescriptor::IsErrorDetected(), hoa_video::ImageDescriptor::Load(), hoa_utils::MakeUnicodeString(), hoa_global::private_global::MAX_ITEM_ID, hoa_script::ReadScriptDescriptor::OpenTable(), hoa_script::ReadScriptDescriptor::ReadBool(), hoa_script::ReadScriptDescriptor::ReadFunctionPointer(), hoa_script::ReadScriptDescriptor::ReadInt(), hoa_script::ReadScriptDescriptor::ReadString(), hoa_script::ReadScriptDescriptor::ReadUInt(), ScriptObject, and hoa_video::StillImage::SetFilename().

Here is the call graph for this function:

hoa_global::GlobalItem::~GlobalItem (  ) 

Definition at line 127 of file global_objects.cpp.

References _battle_use_function, and _menu_use_function.


Member Function Documentation

void hoa_global::GlobalItem::BattleUse ( hoa_battle::private_battle::BattleActor target,
hoa_battle::private_battle::BattleActor instigator 
)

Calls the script function which performs the item's use for battle mode.

Parameters:
target A pointer to the target of the item
instigator A pointer to the instigator that is using the item

Definition at line 140 of file global_objects.cpp.

References _battle_use_function, hoa_global::GlobalObject::_count, hoa_global::GlobalObject::_id, hoa_global::GLOBAL_DEBUG, and IsUsableInBattle().

Referenced by hoa_battle::private_battle::ScriptEvent::RunScript().

Here is the call graph for this function:

GLOBAL_OBJECT hoa_global::GlobalItem::GetObjectType (  )  const [inline, virtual]

Purely virtual function used to distinguish between object types.

Returns:
A value that represents the type of object

Implements hoa_global::GlobalObject.

Definition at line 194 of file global_objects.h.

References hoa_global::GLOBAL_OBJECT_ITEM.

GLOBAL_TARGET hoa_global::GlobalItem::GetTargetType (  )  const [inline]

Definition at line 221 of file global_objects.h.

References _target_type.

Referenced by hoa_battle::private_battle::ScriptEvent::RunScript().

GLOBAL_USE hoa_global::GlobalItem::GetUsage (  )  const [inline]

Definition at line 218 of file global_objects.h.

References _usage.

Referenced by hoa_battle::private_battle::ActionWindow::_ConstructActionSelectionList(), and hoa_menu::private_menu::InventoryWindow::_UpdateItemText().

bool hoa_global::GlobalItem::IsTargetAlly (  )  const [inline]

Definition at line 224 of file global_objects.h.

References _target_ally.

bool hoa_global::GlobalItem::IsUsableInBattle (  )  [inline]

Returns true if the item can be used in battle mode.

Definition at line 198 of file global_objects.h.

References _usage, hoa_global::GLOBAL_USE_ALL, and hoa_global::GLOBAL_USE_BATTLE.

Referenced by BattleUse().

bool hoa_global::GlobalItem::IsUsableInMenu (  )  [inline]

Returns true if the item can be used in menu mode.

Definition at line 202 of file global_objects.h.

References _usage, hoa_global::GLOBAL_USE_ALL, and hoa_global::GLOBAL_USE_MENU.

Referenced by MenuUse().

void hoa_global::GlobalItem::MenuUse ( GlobalCharacter target  ) 

Calls the script function which performs the item's use for menu mode.

Parameters:
target A pointer to the target of the item

Definition at line 161 of file global_objects.cpp.

References hoa_global::GlobalObject::_count, hoa_global::GlobalObject::_id, _menu_use_function, hoa_global::GLOBAL_DEBUG, and IsUsableInMenu().

Here is the call graph for this function:


Member Data Documentation

ScriptObject* hoa_global::GlobalItem::_battle_use_function [private]

A pointer to the script function that performs the item's effect while in battle.

Definition at line 244 of file global_objects.h.

Referenced by BattleUse(), GlobalItem(), and ~GlobalItem().

ScriptObject* hoa_global::GlobalItem::_menu_use_function [private]

A pointer to the script function that performs the item's effect while in a menu.

Definition at line 247 of file global_objects.h.

Referenced by GlobalItem(), MenuUse(), and ~GlobalItem().

bool hoa_global::GlobalItem::_target_ally [private]

If true the item should target allies, otherwise it should target enemies.

Definition at line 241 of file global_objects.h.

Referenced by GlobalItem(), and IsTargetAlly().

GLOBAL_TARGET hoa_global::GlobalItem::_target_type [private]

The type of target for the item. Target types include attack points, actors, and parties. This enum type is defined in global_skills.h.

Definition at line 238 of file global_objects.h.

Referenced by GetTargetType(), and GlobalItem().

GLOBAL_USE hoa_global::GlobalItem::_usage [private]

Values to indicate where the item may be used Items may only be used in either menu mode or battle mode. If an item is to be used in another game mode, then it choose to use either the menu or battle use functions.

Definition at line 233 of file global_objects.h.

Referenced by GetUsage(), GlobalItem(), IsUsableInBattle(), and IsUsableInMenu().


The documentation for this class was generated from the following files:
Generated on Fri Jul 6 23:14:21 2007 for Hero of Allacrost by  doxygen 1.5.1