15 #include <format/format.h> 16 #include "../../clib/clib_endian.h" 17 #include "../../clib/logfacility.h" 18 #include "../../clib/passert.h" 19 #include "../../clib/rawtypes.h" 20 #include "../../plib/systemstate.h" 21 #include "../baseobject.h" 22 #include "../clidata.h" 23 #include "../containr.h" 25 #include "../extobj.h" 26 #include "../globals/object_storage.h" 27 #include "../globals/settings.h" 28 #include "../globals/uvars.h" 29 #include "../lockable.h" 30 #include "../mobile/corpse.h" 31 #include "../module/uomod.h" 32 #include "../multi/boatcomp.h" 33 #include "../objtype.h" 34 #include "../polcfg.h" 35 #include "../resource.h" 36 #include "../scrdef.h" 37 #include "../scrsched.h" 38 #include "../spelbook.h" 41 #include "../uobject.h" 58 return create(
id, serial );
69 message.Format(
"Objtype not defined : 0x{:X}" ) << objtype;
72 throw std::runtime_error( message.str() );
83 u32 objtype =
id.objtype;
84 unsigned short graphic =
id.graphic;
90 item =
new Core::UDoor( static_cast<const DoorDesc&>(
id ) );
102 else if ( ( objtype >=
Core::gamestate.spell_scroll_objtype_limits[0][0] &&
113 item =
new Core::UCorpse( static_cast<const ContainerDesc&>(
id ) );
129 item =
new UWeapon( static_cast<const WeaponDesc&>(
id ), permanent_descriptor );
135 item =
new UArmor( static_cast<const ArmorDesc&>(
id ), permanent_descriptor );
139 item =
new Core::Map( static_cast<const MapDesc&>(
id ) );
162 if ( item->
facing == 127 )
199 std::string value_self;
200 if ( !item->
getprop(
"ct", value_self ) )
208 if ( !
id.control_script.empty() )
210 passert( item->process() == nullptr );
215 uoemod->attached_item_ = item;
216 item->process( uoemod );
220 POLLOG <<
"Unable to start control script " <<
id.control_script.name() <<
" for " 221 <<
id.objtype_description() <<
"\n";
230 item->fire_resist( item->fire_resist().addToValue(
id.element_resist.fire ) );
231 item->fire_damage( item->fire_damage().addToValue(
id.element_damage.fire ) );
234 item->cold_resist( item->cold_resist().addToValue(
id.element_resist.cold ) );
235 item->cold_damage( item->cold_damage().addToValue(
id.element_damage.cold ) );
238 item->energy_resist( item->energy_resist().addToValue(
id.element_resist.energy ) );
239 item->energy_damage( item->energy_damage().addToValue(
id.element_damage.energy ) );
242 item->poison_resist( item->poison_resist().addToValue(
id.element_resist.poison ) );
243 item->poison_damage( item->poison_damage().addToValue(
id.element_damage.poison ) );
246 item->physical_resist( item->physical_resist().addToValue(
id.element_resist.physical ) );
247 item->physical_damage( item->physical_damage().addToValue(
id.element_damage.physical ) );
254 if (
id.desc != origid.
desc )
static Item * create(u32 objtype, u32 serial=0)
virtual Bscript::BObjectImp * make_ref() POL_OVERRIDE
void setprop(const std::string &propname, const std::string &propvalue)
unsigned char tilelayer(unsigned short tilenum)
std::string decint(unsigned short v)
const ItemDesc & find_itemdesc(unsigned int objtype)
std::unique_ptr< Items::ItemDesc > temp_itemdesc
bool getprop(const std::string &propname, std::string &propvalue) const
unsigned int starboard_plank
Item(const ItemDesc &itemdesc, Core::UOBJ_CLASS uobj_class)
u32 GetNewItemSerialNumber(void)
boost_utils::object_name_flystring desc
u32 UseItemSerialNumber(u32 serial)
gameclock_t read_gameclock()
Reads the current value of the game clock.
void setname(const std::string &)
void remove_resources(u32 objtype, u16)
SettingsManager settingsManager
bool Insert(UObject *obj)
void restart_decay_timer()
ObjectStorageManager objStorageManager
bool objtype_is_lockable(u32 objtype)
void start_script(const char *filename, Bscript::BObjectImp *param0, Bscript::BObjectImp *param1)
void copyprops(const UObject &obj)