Pol  Rev 533
NPC Class Reference

#include <npc.h>

+ Inheritance diagram for NPC:
+ Collaboration diagram for NPC:

List of all members.

Public Member Functions

 NPC (u32 objtype, const ConfigElem &elem)
NpcTemplate::ALIGNMENT alignment () const
bool anchor_allows_move (UFACING dir) const
virtual void apply_raw_damage_hundredths (unsigned int damage, Character *source, bool userepsys=true, bool send_damage_packet=false)
virtual unsigned short ar () const
virtual double armor_absorb_damage (double damage)
bool can_accept_event (EVENTID eventid)
virtual bool can_be_renamed_by (const Character *chr) const
const char * classname () const
bool could_move (UFACING dir) const
virtual BObjectImp * custom_script_method (const char *methodname, Executor &ex)
virtual void destroy ()
virtual void get_hitscript_params (double damage, UArmor **parmor, unsigned short *rawdamage)
virtual BObjectImp * get_script_member (const char *membername) const
virtual BObjectImp * get_script_member_id (const int id) const
virtual void inform_criminal (Character *thecriminal)
virtual void inform_disengaged (Character *disengaged)
virtual void inform_engaged (Character *engaged)
virtual void inform_enteredarea (Character *whoentered)
virtual void inform_imoved (Character *chr)
virtual void inform_leftarea (Character *wholeft)
virtual void inform_moved (Character *moved)
virtual UWeapon * intrinsic_weapon ()
void loadDamages (int damageType, ConfigElem &elem)
void loadResistances (int resistanceType, ConfigElem &elem)
Character * master () const
bool npc_path_blocked (UFACING dir) const
virtual void on_death (Item *corpse)
virtual void on_ghost_pc_spoke (Character *src_chr, const char *speech, u8 texttype)
virtual void on_ghost_pc_spoke (Character *src_chr, const char *speech, u8 texttype, const u16 *wspeech, const char lang[4], ObjArray *speechtokens=NULL)
virtual void on_give_item ()
virtual void on_pc_spoke (Character *src_chr, const char *speech, u8 texttype)
virtual void on_pc_spoke (Character *src_chr, const char *speech, u8 texttype, const u16 *wspeech, const char lang[4], ObjArray *speechtokens=NULL)
virtual void printDebugProperties (std::ostream &os) const
virtual void printOn (std::ostream &os) const
virtual void printProperties (std::ostream &os) const
virtual void printSelfOn (std::ostream &os) const
void readNewNpcAttributes (ConfigElem &elem)
void readNpcProperties (ConfigElem &elem)
virtual void readProperties (ConfigElem &elem)
void readPropertiesForNewNPC (ConfigElem &elem)
virtual void refresh_ar ()
void restart_script ()
virtual bool script_isa (unsigned isatype) const
virtual BObjectImp * script_method (const char *methodname, Executor &ex)
virtual BObjectImp * script_method_id (const int id, Executor &ex)
BObjectImp * send_event (BObjectImp *event)
virtual BObjectImp * set_script_member (const char *membername, int value)
 id test
virtual BObjectImp * set_script_member (const char *membername, const std::string &)
 id test
virtual BObjectImp * set_script_member_id (const int id, int value)
virtual BObjectImp * set_script_member_id (const int id, const std::string &)
void start_script ()

Public Attributes

unsigned short damaged_sound
unsigned short run_speed
bool use_adjustments
unsigned short dstart
bool enabled
unsigned short psub
unsigned short x
unsigned short y

Protected Member Functions

void stop_scripts ()

Protected Attributes

UOExecutor * ex
UOExecutor * give_item_ex
std::string template_name

Private Types

typedef Character base

Private Member Functions

 NPC (const NPC &npc)
virtual ~NPC ()
virtual unsigned char hilite_color_idx (const Character *seen_by) const
virtual unsigned short name_color (const Character *seen_by) const
NPC & operator= (const NPC &npc)
virtual void repsys_on_attack (Character *defender)
virtual void repsys_on_damage (Character *defender)
virtual void repsys_on_help (Character *recipient)
void reset_element_damage (unsigned damage)
void reset_element_resist (unsigned resist)

Private Attributes

struct {
   unsigned short   dstart
   bool   enabled
   unsigned short   psub
   unsigned short   x
   unsigned short   y
} anchor
ElementDamages element_damage_
Resistances element_resist_
CharacterRef master_
unsigned short npc_ar_
std::string script
unsigned short speech_color_
unsigned short speech_font_
const NpcTemplate & template_

Friends

class NPCExecutorModule
class ref_ptr< NPC >
class RepSystem

Detailed Description

Definition at line 38 of file npc.h.


Member Typedef Documentation

typedef Character NPC::base [private]

Reimplemented from Character.

Definition at line 40 of file npc.h.


Constructor & Destructor Documentation

NPC::NPC ( u32  objtype,
const ConfigElem &  elem 
) [explicit]

Definition at line 97 of file npc.cpp.

References anchor, Character::connected, Character::logged_in, and npc_count.

NPC::~NPC ( ) [private, virtual]

Definition at line 115 of file npc.cpp.

References npc_count, and stop_scripts().

+ Here is the call graph for this function:

NPC::NPC ( const NPC &  npc) [private]

Member Function Documentation

Definition at line 165 of file npc.h.

Referenced by Character::repsys_on_attack(), Character::repsys_on_damage(), and Character::repsys_on_help().

+ Here is the caller graph for this function:

bool NPC::anchor_allows_move ( UFACING  dir) const

Definition at line 162 of file npc.cpp.

References anchor, Character::dir, move_delta, pol_distance(), random_int(), Character::warmode, x, MoveDelta::xmove, y, and MoveDelta::ymove.

Referenced by could_move(), and NPCExecutorModule::move_self().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void NPC::apply_raw_damage_hundredths ( unsigned int  damage,
Character *  source,
bool  userepsys = true,
bool  send_damage_packet = false 
) [virtual]

Reimplemented from Character.

Definition at line 927 of file npc.cpp.

References Character::apply_raw_damage_hundredths(), UOExecutor::eventmask, EVID_DAMAGED, ex, UOExecutor::os_module, and OSExecutorModule::signal_event().

+ Here is the call graph for this function:

unsigned short NPC::ar ( ) const [inline, virtual]

Reimplemented from Character.

Definition at line 183 of file npc.h.

References Character::ar_, and npc_ar_.

double NPC::armor_absorb_damage ( double  damage) [virtual]

Reimplemented from Character.

Definition at line 948 of file npc.cpp.

References Character::ar_mod(), Character::armor_absorb_damage(), Watch::combat, npc_ar_, random_int(), and watch.

+ Here is the call graph for this function:

bool NPC::can_be_renamed_by ( const Character *  chr) const [virtual]

Reimplemented from Character.

Definition at line 655 of file npc.cpp.

References ref_ptr< T >::get(), and master_.

+ Here is the call graph for this function:

const char * NPC::classname ( ) const [virtual]

Reimplemented from Character.

Definition at line 149 of file npc.cpp.

Referenced by printOn().

+ Here is the caller graph for this function:

bool NPC::could_move ( UFACING  dir) const

Definition at line 186 of file npc.cpp.

References anchor_allows_move(), Character::dir, Character::gradual_boost, move_delta, npc_path_blocked(), UObject::realm, Realm::walkheight(), x, MoveDelta::xmove, y, MoveDelta::ymove, and UObject::z.

Referenced by NPCExecutorModule::_internal_move(), and NPCExecutorModule::CanMove().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

BObjectImp * NPC::custom_script_method ( const char *  methodname,
Executor &  ex 
) [virtual]

Reimplemented from Character.

Definition at line 2509 of file uoscrobj.cpp.

References ExportScript::call(), ExportScript::FindExportedFunction(), Executor::fparams, Character::make_ref(), NpcTemplate::method_script, Executor::numParams(), and template_.

+ Here is the call graph for this function:

void NPC::destroy ( ) [virtual]

Reimplemented from Character.

Definition at line 131 of file npc.cpp.

References UMulti::as_house(), Character::destroy(), UContainer::destroy_contents(), Character::registered_house, system_find_multi(), UHouse::unregister_object(), and Character::wornitems.

Referenced by on_death().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void NPC::get_hitscript_params ( double  damage,
UArmor **  parmor,
unsigned short *  rawdamage 
) [virtual]

Reimplemented from Character.

Definition at line 972 of file npc.cpp.

References Character::ar_mod(), calc_thru_damage(), Character::get_hitscript_params(), and npc_ar_.

+ Here is the call graph for this function:

BObjectImp * NPC::get_script_member ( const char *  membername) const [virtual]

Reimplemented from Character.

Definition at line 2413 of file uoscrobj.cpp.

References get_script_member_id(), getKnownObjMember(), and ObjMember::id.

+ Here is the call graph for this function:

unsigned char NPC::hilite_color_idx ( const Character *  seen_by) const [private, virtual]

[16] NPC Highlighting If the NPC has a master, Highlight color is the same as the Master's. Else the NPC is invul Hilite them invul is ssopt.cfg option says to. Else Highlight Good NPCs INNOCENT (Blue) Highlight Neutral NPCs ATTACKABLE (Grey) Highlight Evil NPCs MURDERER (Red)

Reimplemented from Character.

Definition at line 993 of file repsys.cpp.

References NpcTemplate::alignment, ExportedFunction::call_long(), CHAR_HILITE_ATTACKABLE, CHAR_HILITE_INNOCENT, CHAR_HILITE_INVUL, CHAR_HILITE_MURDERER, NpcTemplate::EVIL, NpcTemplate::GOOD, RepSys_Cfg::HighLightColor, RepSys_Cfg::Hooks, Character::invul(), ServSpecOpt::invul_tag, Character::is_criminal(), Character::is_murderer(), Character::make_ref(), master(), NpcTemplate::NEUTRAL, repsys_cfg, ssopt, and template_.

+ Here is the call graph for this function:

void NPC::inform_disengaged ( Character *  disengaged) [virtual]

Reimplemented from Character.

Definition at line 767 of file npc.cpp.

References UOExecutor::eventmask, EVID_DISENGAGED, ex, UOExecutor::os_module, and OSExecutorModule::signal_event().

+ Here is the call graph for this function:

void NPC::inform_engaged ( Character *  engaged) [virtual]

Reimplemented from Character.

Definition at line 754 of file npc.cpp.

References UOExecutor::eventmask, EVID_ENGAGED, ex, UOExecutor::os_module, and OSExecutorModule::signal_event().

+ Here is the call graph for this function:

UWeapon * NPC::intrinsic_weapon ( ) [virtual]

Reimplemented from Character.

Definition at line 986 of file npc.cpp.

References NpcTemplate::intrinsic_weapon, template_, and wrestling_weapon.

Character * NPC::master ( ) const [inline]

Definition at line 160 of file npc.h.

References ref_ptr< T >::get(), and master_.

Referenced by get_script_member_id(), hilite_color_idx(), name_color(), repsys_on_attack(), Character::repsys_on_attack(), repsys_on_damage(), Character::repsys_on_damage(), repsys_on_help(), and Character::repsys_on_help().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool NPC::npc_path_blocked ( UFACING  dir) const

Definition at line 217 of file npc.cpp.

References Character::cached_settings, Zone::characters, Character::dead(), Character::dir, Character::is_visible_to_me(), move_delta, UObject::realm, x, UObject::x, MoveDelta::xmove, y, UObject::y, MoveDelta::ymove, UObject::z, Realm::zone, and zone_convert_clip().

Referenced by could_move().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void NPC::on_ghost_pc_spoke ( Character *  src_chr,
const char *  speech,
u8  texttype 
) [virtual]
void NPC::on_ghost_pc_spoke ( Character *  src_chr,
const char *  speech,
u8  texttype,
const u16 *  wspeech,
const char  lang[4],
ObjArray *  speechtokens = NULL 
) [virtual]
void NPC::on_give_item ( ) [virtual]

Definition at line 660 of file npc.cpp.

void NPC::on_pc_spoke ( Character *  src_chr,
const char *  speech,
u8  texttype 
) [virtual]

Definition at line 666 of file npc.cpp.

References Character::deafened(), ServSpecOpt::event_visibility_core_checks, UOExecutor::eventmask, EVID_SPOKE, ex, inrangex(), Character::is_visible_to_me(), UOExecutor::os_module, OSExecutorModule::signal_event(), UOExecutor::speech_size, ssopt, and TextTypeToString().

Referenced by npc_spoke(), and pc_spoke().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void NPC::on_pc_spoke ( Character *  src_chr,
const char *  speech,
u8  texttype,
const u16 *  wspeech,
const char  lang[4],
ObjArray *  speechtokens = NULL 
) [virtual]
NPC& NPC::operator= ( const NPC &  npc) [private]
void NPC::printDebugProperties ( std::ostream &  os) const [virtual]

Reimplemented from Character.

Definition at line 308 of file npc.cpp.

References anchor, pf_endl, and Character::printDebugProperties().

+ Here is the call graph for this function:

void NPC::printOn ( std::ostream &  os) const [virtual]

Reimplemented from Character.

Definition at line 243 of file npc.cpp.

References classname(), pf_endl, printProperties(), and template_name.

Referenced by printSelfOn().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void NPC::printSelfOn ( std::ostream &  os) const [virtual]

Reimplemented from Character.

Definition at line 252 of file npc.cpp.

References printOn().

+ Here is the call graph for this function:

Definition at line 538 of file npc.cpp.

References Character::attribute(), ATTRIBUTE_MAX_BASE, AttributeValue::base(), FindAttribute(), Dice::load(), Attribute::next, ConfigElem::remove_prop(), Dice::roll(), and ConfigElem::throw_error().

Referenced by readPropertiesForNewNPC().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void NPC::readProperties ( ConfigElem &  elem) [virtual]

Reimplemented from Character.

Definition at line 520 of file npc.cpp.

References UObject::getprop(), readNpcProperties(), Character::readProperties(), ConfigElemBase::rest(), and template_name.

+ Here is the call graph for this function:

Definition at line 569 of file npc.cpp.

References Character::calc_vital_stuff(), Character::readCommonProperties(), readNewNpcAttributes(), readNpcProperties(), and Character::set_vitals_to_maximum().

Referenced by add_npc().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void NPC::repsys_on_attack ( Character *  defender) [private, virtual]

[13.2] NPC (MA) Attacks Mobile (MB) If MA has a Master (Amy), Apply 'Player Attacks Mobile' rules[->13.1] for Amy vs MB Else Exit with no (RepSystem) effect.

Reimplemented from Character.

Definition at line 835 of file repsys.cpp.

References ExportedFunction::call(), RepSys_Cfg::Hooks, Character::make_ref(), master(), master_, RepSys_Cfg::OnAttack, and repsys_cfg.

+ Here is the call graph for this function:

void NPC::repsys_on_damage ( Character *  defender) [private, virtual]

[14.2] NPC (MA) Damages Mobile (MB) If MA has a Master (Amy), Apply 'Player Damages Mobile' rules[->14.1] for Amy vs MB Else Exit with no (RepSystem) effect.

Reimplemented from Character.

Definition at line 896 of file repsys.cpp.

References ExportedFunction::call(), RepSys_Cfg::Hooks, Character::make_ref(), master(), master_, RepSys_Cfg::OnDamage, and repsys_cfg.

+ Here is the call graph for this function:

void NPC::repsys_on_help ( Character *  helped) [private, virtual]

[15.2] NPC (MA) Helps Mobile (MB) If MA has a Master (Amy), Apply 'Player Helps Mobile' rules[->15.1] for Amy helps MB Else Exit with no (RepSystem) effect.

Reimplemented from Character.

Definition at line 956 of file repsys.cpp.

References ExportedFunction::call(), RepSys_Cfg::Hooks, Character::make_ref(), master(), master_, RepSys_Cfg::OnHelp, and repsys_cfg.

+ Here is the call graph for this function:

Definition at line 580 of file npc.cpp.

References ex, OSExecutorModule::in_debugger_holdlist(), UOExecutor::os_module, OSExecutorModule::revive(), OSExecutorModule::revive_debugged(), script, Executor::seterror(), and start_script().

Referenced by UOExecutorModule::mf_RestartScript().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool NPC::script_isa ( unsigned  isatype) const [virtual]

Reimplemented from Character.

Definition at line 3670 of file uoscrobj.cpp.

References POLCLASS_NPC, and Character::script_isa().

+ Here is the call graph for this function:

BObjectImp * NPC::script_method ( const char *  methodname,
Executor &  ex 
) [virtual]

Reimplemented from Character.

Definition at line 2500 of file uoscrobj.cpp.

References getKnownObjMethod(), ObjMethod::id, and script_method_id().

+ Here is the call graph for this function:

BObjectImp * NPC::script_method_id ( const int  id,
Executor &  ex 
) [virtual]

Reimplemented from Character.

Definition at line 2469 of file uoscrobj.cpp.

References CharacterRef::clear(), getCharacterParam(), master_, MTH_SETMASTER, Executor::numParams(), Character::script_method_id(), CharacterRef::set(), and UObject::set_dirty().

Referenced by script_method().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

BObjectImp * NPC::set_script_member ( const char *  membername,
int  value 
) [virtual]

id test

Reimplemented from Character.

Definition at line 2460 of file uoscrobj.cpp.

References getKnownObjMember(), ObjMember::id, and set_script_member_id().

+ Here is the call graph for this function:

BObjectImp * NPC::set_script_member ( const char *  membername,
const std::string &  value 
) [virtual]

id test

Reimplemented from Character.

Definition at line 2434 of file uoscrobj.cpp.

References getKnownObjMember(), ObjMember::id, and set_script_member_id().

+ Here is the call graph for this function:

BObjectImp * NPC::set_script_member_id ( const int  id,
int  value 
) [virtual]

Reimplemented from Character.

Definition at line 2443 of file uoscrobj.cpp.

References MBR_RUN_SPEED, MBR_SAVEONEXIT, MBR_SPEECH_COLOR, MBR_SPEECH_FONT, MBR_USE_ADJUSTMENTS, run_speed, UObject::saveonexit(), Character::set_script_member_id(), speech_color_, speech_font_, and use_adjustments.

Referenced by set_script_member().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

BObjectImp * NPC::set_script_member_id ( const int  id,
const std::string &  value 
) [virtual]

Reimplemented from Character.

Definition at line 2422 of file uoscrobj.cpp.

References MBR_SCRIPT, script, and Character::set_script_member_id().

+ Here is the call graph for this function:

void NPC::stop_scripts ( ) [protected]

Definition at line 121 of file npc.cpp.

References deschedule_executor(), and ex.

Referenced by ~NPC().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


Friends And Related Function Documentation

friend class NPCExecutorModule [friend]

Definition at line 121 of file npc.h.

Referenced by start_script().

friend class ref_ptr< NPC > [friend]

Reimplemented from UObject.

Definition at line 122 of file npc.h.

friend class RepSystem [friend]

Reimplemented from Character.

Definition at line 131 of file npc.h.


Member Data Documentation

unsigned short NPC::damaged_sound

Definition at line 112 of file npc.h.

Referenced by Character::do_imhit_effects(), and readNpcProperties().

unsigned short NPC::dstart

Definition at line 149 of file npc.h.

Referenced by NPCExecutorModule::mf_SetAnchor().

Definition at line 139 of file npc.h.

Referenced by loadDamages(), printProperties(), and reset_element_damage().

Definition at line 138 of file npc.h.

Referenced by loadResistances(), printProperties(), and reset_element_resist().

Definition at line 146 of file npc.h.

Referenced by NPCExecutorModule::mf_SetAnchor().

Definition at line 117 of file npc.h.

unsigned short NPC::npc_ar_ [private]
unsigned short NPC::psub

Definition at line 150 of file npc.h.

Referenced by NPCExecutorModule::mf_SetAnchor().

std::string NPC::template_name [protected]

Definition at line 119 of file npc.h.

Referenced by get_script_member_id(), on_death(), printOn(), readNpcProperties(), and readProperties().


The documentation for this class was generated from the following files: