Example #1
0
void Vehicle::Load( Unit *owner, uint32 creature_entry, uint32 vehicleid ){
	if( owner == NULL ){
		LOG_ERROR( "Can't load vehicle without an owner." );
		ARCPRO_ASSERT( false );
	}

	vehicle_info = dbcVehicle.LookupEntry( vehicleid );
	if( vehicle_info == NULL ){
		LOG_ERROR( "Can't load a vehicle without vehicle id or data belonging to it." );
		ARCPRO_ASSERT( false );
	}

	for( uint32 i = 0; i < MAX_VEHICLE_SEATS; i++ ){
		uint32 seatid = vehicle_info->seatID[ i ];

		if( seatid != 0 ){
			VehicleSeatEntry *seatinfo = dbcVehicleSeat.LookupEntry( seatid );
			if( seatinfo == NULL ){
				LOG_ERROR( "Invalid seat id %u for seat %u for vehicle id %u", seatid, i, vehicleid );
				continue;
			}

			seats[ i ] = new VehicleSeat( seatinfo );
		}			
	}

	this->creature_entry = creature_entry;
	this->owner = owner;
	
	switch( vehicle_info->powerType ){
	case POWER_TYPE_STEAM:
	case POWER_TYPE_HEAT:
	case POWER_TYPE_BLOOD:
	case POWER_TYPE_OOZE:
	case POWER_TYPE_WRATH:
		owner->SetPowerType( POWER_TYPE_ENERGY );
		owner->SetMaxPower( POWER_TYPE_ENERGY, 100 );
		owner->SetPower( POWER_TYPE_ENERGY, 100 );
		break;
	
	case POWER_TYPE_PYRITE:
		owner->SetPowerType( POWER_TYPE_ENERGY );
		owner->SetMaxPower( POWER_TYPE_ENERGY, 50 );
		owner->SetPower( POWER_TYPE_ENERGY, 50 );
		break;
	}

	for( uint32 i = 0; i < MAX_VEHICLE_SEATS; i++ )
		if( ( seats[ i ] != NULL ) && seats[ i ]->Usable() && ( !seats[ i ]->HasPassenger() ) )
			freeseats++;

}
Example #2
0
void Container::LoadFromDB(Field* fields)
{

	uint32 itemid = fields[2].GetUInt32();
	m_itemProto = ItemPrototypeStorage.LookupEntry(itemid);

	ARCPRO_ASSERT(m_itemProto  != NULL);
	SetEntry(itemid);


	SetCreatorGUID(fields[5].GetUInt32());
	SetStackCount(1);

	SetUInt32Value(ITEM_FIELD_FLAGS, fields[8].GetUInt32());
	SetItemRandomPropertyId(fields[9].GetUInt32());

	SetDurabilityMax(m_itemProto->MaxDurability);
	SetDurability(fields[12].GetUInt32());


	SetNumSlots(m_itemProto->ContainerSlots);

	m_Slot = new Item*[m_itemProto->ContainerSlots];
	memset(m_Slot, 0, sizeof(Item*) * (m_itemProto->ContainerSlots));

}
Example #3
0
void Container::Create(uint32 itemid, Player* owner)
{

	m_itemProto = ItemPrototypeStorage.LookupEntry(itemid);
	ARCPRO_ASSERT(m_itemProto != NULL);

	SetEntry(itemid);

	// TODO: this shouldn't get NULL form containers in mail fix me
	if(owner != NULL)
	{
		SetOwnerGUID(0);
		SetContainerGUID(owner->GetGUID());
	}
	SetStackCount(1);
	SetNumSlots(m_itemProto->ContainerSlots);

	m_Slot = new Item*[m_itemProto->ContainerSlots];
	memset(m_Slot, 0, sizeof(Item*) * (m_itemProto->ContainerSlots));

	m_owner = owner;
}
Example #4
0
/* Hook Stuff */
void ScriptMgr::register_hook(ServerHookEvents event, void* function_pointer)
{
	ARCPRO_ASSERT(event < NUM_SERVER_HOOKS);
	_hooks[event].insert(function_pointer);
}