21 #include "../item/armor.h" 29 #include "../../bscript/bobject.h" 30 #include "../../clib/boostutils.h" 31 #include "../../clib/compilerspecifics.h" 32 #include "../../clib/rawtypes.h" 33 #include "../dynproperties.h" 34 #include "../eventid.h" 35 #include "../item/weapon.h" 36 #include "../npctmpl.h" 37 #include "../reftypes.h" 38 #include "../uconst.h" 66 class NPCExecutorModule;
77 Anchor() : enabled( false ), x( 0 ), y( 0 ), dstart( 0 ), psub( 0 ){};
95 NPC& operator=(
const NPC& npc );
103 virtual
void readProperties( Clib::ConfigElem& elem ) POL_OVERRIDE;
105 virtual Bscript::
BObjectImp* get_script_member( const
char* membername ) const POL_OVERRIDE;
106 virtual Bscript::
BObjectImp* get_script_member_id( const
int id ) const POL_OVERRIDE;
107 virtual Bscript::
BObjectImp* set_script_member( const
char* membername,
int value ) POL_OVERRIDE;
108 virtual Bscript::
BObjectImp* set_script_member( const
char* membername,
109 const
std::
string& ) POL_OVERRIDE;
110 virtual Bscript::
BObjectImp* set_script_member_id( const
int id,
111 int value ) POL_OVERRIDE;
112 virtual Bscript::
BObjectImp* set_script_member_id( const
int id,
113 const
std::
string& ) POL_OVERRIDE;
114 virtual Bscript::
BObjectImp* script_method( const
char* methodname,
115 Bscript::
Executor& ex ) POL_OVERRIDE;
116 virtual Bscript::
BObjectImp* script_method_id( const
int id, Bscript::
Executor& ex ) POL_OVERRIDE;
117 virtual Bscript::
BObjectImp* custom_script_method( const
char* methodname,
118 Bscript::
Executor& ex ) POL_OVERRIDE;
119 virtual
bool script_isa(
unsigned isatype ) const POL_OVERRIDE;
122 virtual const
char* classname() const POL_OVERRIDE;
123 virtual
void printOn( Clib::StreamWriter& sw ) const POL_OVERRIDE;
124 virtual
void printSelfOn( Clib::StreamWriter& sw ) const POL_OVERRIDE;
125 virtual
void printProperties( Clib::StreamWriter& sw ) const POL_OVERRIDE;
126 virtual
void printDebugProperties( Clib::StreamWriter& sw ) const POL_OVERRIDE;
130 virtual Items::
UWeapon* intrinsic_weapon() POL_OVERRIDE;
132 virtual
void inform_disengaged(
Character* disengaged ) POL_OVERRIDE;
133 virtual
void inform_engaged(
Character* engaged ) POL_OVERRIDE;
134 virtual
void inform_criminal(
Character* thecriminal ) POL_OVERRIDE;
135 virtual
void inform_leftarea(
Character* wholeft ) POL_OVERRIDE;
136 virtual
void inform_enteredarea(
Character* whoentered ) POL_OVERRIDE;
137 virtual
void inform_moved(
Character* moved ) POL_OVERRIDE;
138 virtual
void inform_imoved(
Character* chr ) POL_OVERRIDE;
139 virtual
double armor_absorb_damage(
double damage ) POL_OVERRIDE;
140 virtual
void get_hitscript_params(
double damage, Items::
UArmor** parmor,
141 unsigned short* rawdamage ) POL_OVERRIDE;
142 virtual
unsigned short ar() const POL_OVERRIDE;
143 virtual
void refresh_ar() POL_OVERRIDE;
145 virtual
void apply_raw_damage_hundredths(
unsigned int damage,
Character* source,
146 bool userepsys = true,
147 bool send_damage_packet = false ) POL_OVERRIDE;
148 virtual
void on_death( Items::
Item* corpse ) POL_OVERRIDE;
150 virtual
bool can_be_renamed_by( const
Character* chr ) const POL_OVERRIDE;
152 virtual
void repsys_on_attack(
Character* defender ) POL_OVERRIDE;
153 virtual
void repsys_on_damage(
Character* defender ) POL_OVERRIDE;
154 virtual
void repsys_on_help(
Character* recipient ) POL_OVERRIDE;
155 virtual
unsigned char hilite_color_idx( const
Character* seen_by ) const POL_OVERRIDE;
156 virtual
unsigned short name_color( const
Character* seen_by ) const POL_OVERRIDE;
159 virtual
u16 get_damaged_sound() const POL_OVERRIDE;
162 bool use_adjustments() const;
163 void use_adjustments(
bool newvalue );
164 bool could_move( Core::
UFACING dir ) const;
165 bool anchor_allows_move( Core::
UFACING dir ) const;
166 bool npc_path_blocked( Core::
UFACING dir ) const;
171 void on_pc_spoke(
Character* src_chr, const
char* speech,
u8 texttype );
172 void on_ghost_pc_spoke(
Character* src_chr, const
char* speech,
u8 texttype );
174 void on_pc_spoke(
Character* src_chr, const
char* speech,
u8 texttype, const
u16* wspeech,
175 const
char lang[4], Bscript::
ObjArray* speechtokens =
nullptr );
176 void on_ghost_pc_spoke(
Character* src_chr, const
char* speech,
u8 texttype, const
u16* wspeech,
177 const
char lang[4], Bscript::
ObjArray* speechtokens =
nullptr );
178 bool can_accept_event( Core::
EVENTID eventid );
180 bool send_event( Bscript::
BObjectImp* event );
184 void restart_script();
192 void readPropertiesForNewNPC( Clib::ConfigElem& elem );
195 void readNpcProperties( Clib::ConfigElem& elem );
196 void loadEquipablePropertiesNPC( Clib::ConfigElem& elem );
197 void readNewNpcAttributes( Clib::ConfigElem& elem );
213 void resetEquipablePropertiesNPC();
220 bool no_drop_exception() const;
221 void no_drop_exception(
bool newvalue );
223 std::
string templatename() const;
234 unsigned short npc_ar_;
237 unsigned short run_speed;
255 unsigned short damaged_sound;
267 return master_.get();
272 return template_.alignment;
279 if ( shield !=
nullptr && shield->is_intrinsic() )
280 return npc_ar_ + shield->ar();
const unsigned short DEFAULT_TEXT_COLOR
const unsigned short DEFAULT_TEXT_FONT
ref_ptr< Mobile::Character > CharacterRef
virtual unsigned short ar() const POL_OVERRIDE
boost::flyweight< std::string, boost::flyweights::tag< script_name_tag >, FLYWEIGHT_HASH_FACTORY > script_name_flystring
#define DYN_PROPERTY(name, type, id, defaultvalue)
void start_script(const char *filename, Bscript::BObjectImp *param0, Bscript::BObjectImp *param1)
Core::NpcTemplate::ALIGNMENT alignment() const
boost::flyweight< std::string, boost::flyweights::tag< npctemplate_name_tag >, FLYWEIGHT_HASH_FACTORY > npctemplate_name_flystring